1, RuntimeError
Reason: This is the default exception raised by the raise method
[code]
raise
[/code]
2, NoMethodError
Reason: An object is sent a message it can't resolve to a method name
[code]
a = Object.new
a.some_unkonw_method_name
[/code]
3, NameError
Reason: The interpreter hits an identifier it can't resolve as a variable or method name
[code]
a = some_random_identifier
[/code]
4, IOError
Reason: This is caused by reading a closed stream, writing to a read-only stream, and similar operations
[code]
STDIN.puts("Don't write to STDIN!")
[/code]
5, Errno::error
Reason: This family of errors relates to file IO
[code]
File.open(-12)
[/code]
6, TypeError
Reason: A method receives an argument it can't handle
[code]
a = 3 + "can't add a string to a number!"
[/code]
7, ArgumentError
Reason: This is caused by using the wrong number of arguments
[code]
def m(x); end; m(1, 2, 3, 4, 5)
[/code]
Reason: This is the default exception raised by the raise method
[code]
raise
[/code]
2, NoMethodError
Reason: An object is sent a message it can't resolve to a method name
[code]
a = Object.new
a.some_unkonw_method_name
[/code]
3, NameError
Reason: The interpreter hits an identifier it can't resolve as a variable or method name
[code]
a = some_random_identifier
[/code]
4, IOError
Reason: This is caused by reading a closed stream, writing to a read-only stream, and similar operations
[code]
STDIN.puts("Don't write to STDIN!")
[/code]
5, Errno::error
Reason: This family of errors relates to file IO
[code]
File.open(-12)
[/code]
6, TypeError
Reason: A method receives an argument it can't handle
[code]
a = 3 + "can't add a string to a number!"
[/code]
7, ArgumentError
Reason: This is caused by using the wrong number of arguments
[code]
def m(x); end; m(1, 2, 3, 4, 5)
[/code]