8.7 Quiz answers
error
,warning
, andmessage
.You could use
try()
ortryCatch()
.tryCatch()
creates exiting handlers which will terminate the execution of wrapped code;withCallingHandlers()
creates calling handlers which don’t affect the execution of wrapped code.Because you can then capture specific types of error with
tryCatch()
, rather than relying on the comparison of error strings, which is risky, especially when messages are translated.