Exception handling (programming): Difference between revisions

Content deleted Content added
Dylwi (talk | contribs)
add Rexx and ooRexx as languages with built-in syntactic support for exception handling
Tags: Reverted Visual edit
Restored revision 1292259528 by TonySt (talk): Rv mention of obscure language
Line 44:
{{Further|Exception handling syntax}}
 
Many computer languages have built-in syntactic support for exceptions and exception handling. This includes [[ActionScript]], [[Ada programming language|Ada]], [[BlitzMax]], [[C++]], [[C Sharp (programming language)|C#]], [[Clojure]], [[COBOL]], [[D programming language|D]], [[ECMAScript]], [[Eiffel (programming language)|Eiffel]], [[Java (programming language)|Java]], [[ML programming language|ML]], [[Object Pascal]] (e.g. [[Delphi (programming language)|Delphi]], [[Free Pascal]], and the like), [[Object REXX|ooRexx]], [[PowerBuilder]], [[Objective-C]], [[OCaml]], Perl,<ref>{{Cite web |title=Exceptions - Documentation for exception handling in Perl |url=https://metacpan.org/pod/Exceptions}}</ref> [[PHP]] (as of version 5), [[PL/I]], [[PL/SQL]], [[Prolog]], [[Python (programming language)|Python]], [[Rexx]], [[REALbasic]], [[Ruby (programming language)|Ruby]], [[Scala (programming language)|Scala]], [[Seed7]], [[Smalltalk]], [[Tcl]], [[Visual Prolog]] and most [[.NET Framework|.NET]] languages.
 
Excluding minor syntactic differences, there are only a couple of exception handling styles in use. In the most popular style, an exception is initiated by a special statement (<code>throw</code> or <code>raise</code>) with an exception object (e.g. with Java or Object Pascal) or a value of a special extendable enumerated type (e.g. with Ada or SML). The scope for exception handlers starts with a marker clause (<code>try</code> or the language's block starter such as <code>begin</code>) and ends in the start of the first handler clause (<code>catch</code>, <code>except</code>, <code>rescue</code>). Several handler clauses can follow, and each can specify which exception types it handles and what name it uses for the exception object. As a minor variation, some languages use a single handler clause, which deals with the class of the exception internally.