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 http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasExceptions&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22null%22%2C%22data%22%3A%22hasExceptions%22%2C%22origData%22%3A%22hasExceptions%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D missing http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasExceptions&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22!null%22%2C%22data%22%3A%22hasExceptions%22%2C%22origData%22%3A%22hasExceptions%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D with * Read more about Exceptions on the web: 1. https://en.wikipedia.org/wiki/Exception_handling 1. Built with Scroll v178.2.3