try-catch

Error handling block

Try-catch is a programming construct for handling errors.

Code that might fail goes in the try block; if an error occurs, execution jumps to the catch block instead of crashing the program.

The try-catch prevented the app from dying when the server was unreachable.

Most modern programming languages use this pattern, though syntax varies.

mechanism

exception

Deviation from standard

  • errorFault in communication
  • blockSolid mass, or impede
  • throwPropel by arm motion

finally · handler · clause · statement · syntax · runtime · propagation · unwinding · nesting · scope

errorhandling

fallback

Alternative if primary fails

defensive · robustness · resilience · fail-safe · recovery · retry · rollback · cleanup · dispose · timeout

languages

Java

Programming language from Sun

  • JavaScriptWeb programming language
  • PythonLarge nonvenomous squeezer
  • C++Object-oriented systems language

C# · PHP · Ruby · Swift · Kotlin · TypeScript · except · defer · promise · callback

Categories
Opposites
error handling strategy

try-catchinput validation

prevention · assertion · sanitization

programming paradigm for robustness

try-catcherror code

Numbered malfunction message

control flow philosophy

try-catchabort

End before completion

panic · crash and burn · crash

Family

try, catch, trying, catches, caught, catching, catcher, catchy

Familiarity
Top 1,000,000
Profile
Used worldwide · Timeless · Abstract · Rated G