Last active
June 5, 2021 04:45
-
-
Save mosufy/71ac9ac5208c6cac53f292ce60b52624 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 { | |
const user = { | |
username: 'JohnDoe', | |
gender: 'male', | |
} | |
validateUsernameFormat(user.username); | |
await checkUsernameExists(user.username); | |
const userId = await insertNewUser(user); | |
await sendMessage('User created', { userId, user }); | |
return { | |
data: { | |
message: 'User created successfully!' | |
} | |
} | |
} catch (error) { | |
return { | |
error: { | |
message: error.message, | |
code: 'FAILED_CREATE_USER', | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment