Skip to content

Instantly share code, notes, and snippets.

@tikarammardi
Last active August 9, 2022 02:48
Show Gist options
  • Save tikarammardi/7ff1bba413b045d73742f5da55ae4026 to your computer and use it in GitHub Desktop.
Save tikarammardi/7ff1bba413b045d73742f5da55ae4026 to your computer and use it in GitHub Desktop.
create, throw, and handle the error
// main
function main(){
try{
if(conditon){
throw new Error('We have error here, bye bye , see you in catch block');
}
// this part of code it won't reach
}catch(e){
console.log('Error is :', e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment