Skip to content

lesson-9 testing questions #2466

Answered by othaime-en
TimeKeyRoll asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @MasterofBlockchain the try--catch block is mainly useful because it lets us handle the error and terminate the program execution gracefully. When using the normal program flow, if an error is thrown the program abruptly ends and prints out the error. However when we use a try...catch block it gives us control on what to do when an error occurs. Say we don't want to see the error log, we could just say that if an error occurs prints a specific error message or a shortened version of the error or just a statement like an error occured. Additionally, we could do other things like run a specific function if a certain specific error occurs among other things. Using a try...catch gives us …

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@TimeKeyRoll
Comment options

@othaime-en
Comment options

@TimeKeyRoll
Comment options

@othaime-en
Comment options

@TimeKeyRoll
Comment options

Answer selected by TimeKeyRoll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants