Add error handling to databaseCreate + unit tests