Created
June 5, 2021 04:22
-
-
Save mosufy/7cbfaa2e0c66215bdc553cd751820913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
validateUsernameFormat(user.username); | |
await checkUsernameExists(user.username); | |
} catch (error) { | |
return { | |
// a better approach is to have a response success/error function | |
error: { | |
message: error.message, | |
code: 'FAILED_USERNAME_VALIDATION', | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment