Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Exceptions

< >
Example from 1 languages: JavaScript
try { undefinedFn() } catch (err) { console.log(err) }
Example from 1 languages: Ruby
def hello puts "Hello, World!" # start an exception handler begin raise "This is an exception" rescue => e puts "Exception caught: #{e}" end end hello
Example from 1 languages: Elixir
raise "oops, something went wrong"
Example from 1 languages: Chapel
throw throws
Example from 1 languages: MoonBit
type! DivError String fn div(x: Int, y: Int) -> Int!DivError { if y == 0 { raise DivError("division by zero") } x / y }
Example from 1 languages: REBOL
catch [throw 22 print "You'll never see this."] try/except [read %does_not_exist] [print "File not found"]
Example from 1 languages: Aardvark
Has throw, try, and catch
Example from 1 languages: Boron
catch [throw 22 print "You'll never see this."] if error? try [read %does_not_exist] [print "File not found"]
*

Languages with Exceptions include JavaScript, Java, C++, Ruby, PHP, C#, PowerShell, Swift, Scala, Kotlin, CoffeeScript, Elixir, Dart, Solidity, Chapel, Groovy, ABAP, MoonBit, REBOL, X10, Apex, Sophia, Aardvark, Boron

*

Languages without Exceptions include C, progsbase, Speedie

*

View all concepts with or missing a hasExceptions measurement

*

Read more about Exceptions on the web: 1.

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements