Top Banner
Ruby Exceptions!
63

Ruby exceptions

Aug 03, 2015

Download

Technology

Johalf Farina
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ruby exceptions

Ruby Exceptions!

Page 2: Ruby exceptions

Hierarch and usage

Page 3: Ruby exceptions

NoMemoryError!

Page 4: Ruby exceptions

NoMemoryError

Raised when memory

allocation fails.

Page 5: Ruby exceptions

ScriptError!

Page 6: Ruby exceptions

ScriptError

Superclass for errors raised when a script can

not be executed

Page 7: Ruby exceptions

ScriptError Hierarch

Page 8: Ruby exceptions

LoadError

Raised when a file required fails to load

Page 9: Ruby exceptions
Page 10: Ruby exceptions

NotImplementedError

Raised when a feature is not

implemented on the current platform

Page 11: Ruby exceptions
Page 12: Ruby exceptions

SyntaxError

Raised when encountering Ruby code with an invalid

syntax

Page 13: Ruby exceptions
Page 14: Ruby exceptions

SignalException!SignalException!

Page 15: Ruby exceptions

Raised when a signal is received

SignalException

Page 16: Ruby exceptions

SignalException Hierarch

Page 17: Ruby exceptions

Interrupt

Raised with the interrupt signal is received, typically

because the user pressed on Control-C

Page 18: Ruby exceptions
Page 19: Ruby exceptions

StandardError!

Page 20: Ruby exceptions

StandardError

The most standard error types are subclasses of StandardError

Page 21: Ruby exceptions

StandardError Hierarch

Page 22: Ruby exceptions

ArgumentError

Raised when the arguments are

wrong

Page 23: Ruby exceptions
Page 24: Ruby exceptions

IndexError

Raised when the given index is

invalid.

Page 25: Ruby exceptions
Page 26: Ruby exceptions

StopIteration < IndexError

Raised to stop the iteration, in particular by

Enumerator#next

Page 27: Ruby exceptions
Page 28: Ruby exceptions

IOError

Raised when an IO operation fails.

Page 29: Ruby exceptions
Page 30: Ruby exceptions

EOFError < IOError

Raised by some IO operations when

reaching the end of file, nil for example

Page 31: Ruby exceptions
Page 32: Ruby exceptions

LocalJumpError

Raised when Ruby can't yield as

requested

Page 33: Ruby exceptions
Page 34: Ruby exceptions

NameError

Raised when a given name is invalid or

undefined

Page 35: Ruby exceptions
Page 36: Ruby exceptions

NoMethodError < NameError

Raised when a method is called on a

receiver which doesn't have it

defined

Page 37: Ruby exceptions
Page 38: Ruby exceptions

RangeError

Raised when a given numerical value is

out of range

Page 39: Ruby exceptions
Page 40: Ruby exceptions

FloatDomainError < RangeError

Raised when attempting to

convert special float values

Page 41: Ruby exceptions
Page 42: Ruby exceptions

RegexpError

Raised when given an invalid regexp

expression.

Page 43: Ruby exceptions
Page 44: Ruby exceptions

RuntimeError *default for raise

A generic error class raised when an

invalid operation is attempted.

Page 45: Ruby exceptions
Page 46: Ruby exceptions

SecurityError

Raised when attempting a potential

unsafe operation, typically when the

$SAFE level is raised above 0.

Page 47: Ruby exceptions
Page 48: Ruby exceptions

SystemCallError

SystemCallError is the base class for all low-

level platform-dependent errors.

Page 49: Ruby exceptions
Page 50: Ruby exceptions

SystemStackError

Raised in case of a stack overflow.

Page 51: Ruby exceptions
Page 52: Ruby exceptions

ThreadError

Raised when an invalid operation is

attempted on a thread.

Page 53: Ruby exceptions
Page 54: Ruby exceptions

TypeError

Raised when encountering an

object that is not of the expected type.

Page 55: Ruby exceptions
Page 56: Ruby exceptions

ZeroDivisionError

Raised when attempting to divide

an integer by 0

Page 57: Ruby exceptions
Page 58: Ruby exceptions

SystemExit!

Page 59: Ruby exceptions

Raised by exit to initiate the

termination of the script.

Page 60: Ruby exceptions
Page 61: Ruby exceptions

fatal – impossible to rescue!

Page 62: Ruby exceptions

Thanks