Skip to content

Instantly share code, notes, and snippets.

@mrcampbell
Created December 8, 2019 21:48
Show Gist options
  • Save mrcampbell/09b0cf30f7f3bc5b8b09e31fa65aa66c to your computer and use it in GitHub Desktop.
Save mrcampbell/09b0cf30f7f3bc5b8b09e31fa65aa66c to your computer and use it in GitHub Desktop.
function createUser(name, age, address) {
try {
validateUser({name, age, address})
} catch (err) {
throw Error("User is not valid")
}
// insert into database, then return result
return db.insertUser({name, age, address})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment