Exceptions are a language feature.
In general, an exception breaks the normal flow of execution and executes a pre-registered exception handler.
Languages with Exceptions include Java, JavaScript, C++, PHP, Ruby, C#, Scala, Swift, Kotlin, PowerShell, Dart, Groovy, CoffeeScript, Solidity, X10, ABAP, Apex, Sophia
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