try {
undefinedFn()
} catch (err) {
console.log(err)
}
def hello
puts "Hello, World!"
# start an exception handler
begin
raise "This is an exception"
rescue => e
puts "Exception caught: #{e}"
end
end
hello
raise "oops, something went wrong"
catch [throw 22 print "You'll never see this."]
try/except [read %does_not_exist] [print "File not found"]
Has throw, try, and catch
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, Groovy, ABAP, 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.