Skip to content

Instantly share code, notes, and snippets.

@ellcs
Last active March 10, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ellcs/fa1e4c201c783fcfe615826577b750fc to your computer and use it in GitHub Desktop.
Save ellcs/fa1e4c201c783fcfe615826577b750fc to your computer and use it in GitHub Desktop.
Complete ruby exception list
# Public Domain
class Class
def descendants
ObjectSpace.each_object(Class).select { |klass| klass <= self }
end
def ancestor_class
ancestors[1..-1].find { |p| p.is_a?(Class) }
end
def direct_descendants
ObjectSpace.each_object(Class).select { |klass| klass.ancestor_class == self }
end
end
def traverse_children(klass, depth = 1, &block)
klass.direct_descendants.each do |descendant|
block.call(depth, descendant)
traverse_children(descendant, depth + 1, &block)
end
end
File.open("exception.txt", "w") do |file|
file.puts(Exception.to_s)
traverse_children(Exception) do |depth, klass|
indentation = ' ' * (depth*2)
file.puts("#{indentation}#{klass}")
end
end
Exception
SystemStackError
NoMemoryError
SecurityError
ScriptError
NotImplementedError
LoadError
Gem::LoadError
Gem::ConflictError
Gem::MissingSpecError
Gem::MissingSpecVersionError
SyntaxError
StandardError
URI::Error
URI::BadURIError
URI::InvalidComponentError
URI::InvalidURIError
FiberError
ThreadError
Math::DomainError
LocalJumpError
IOError
EOFError
RegexpError
ZeroDivisionError
SystemCallError
Errno::EHWPOISON
Errno::ERFKILL
Errno::EOWNERDEAD
Errno::ENOTRECOVERABLE
Errno::ENOMEDIUM
Errno::ENOKEY
Errno::EMEDIUMTYPE
Errno::EKEYREVOKED
Errno::EKEYREJECTED
Errno::EKEYEXPIRED
Errno::ECANCELED
Errno::EDQUOT
Errno::EREMOTEIO
Errno::EISNAM
Errno::ENAVAIL
Errno::ENOTNAM
Errno::EUCLEAN
Errno::ESTALE
Errno::EINPROGRESS
IO::EINPROGRESSWaitWritable
IO::EINPROGRESSWaitReadable
Errno::EALREADY
Errno::EHOSTUNREACH
Errno::EHOSTDOWN
Errno::ECONNREFUSED
Errno::ETIMEDOUT
Errno::ETOOMANYREFS
Errno::ESHUTDOWN
Errno::ENOTCONN
Errno::EISCONN
Errno::ENOBUFS
Errno::ECONNRESET
Errno::ECONNABORTED
Errno::ENETRESET
Errno::ENETUNREACH
Errno::ENETDOWN
Errno::EADDRNOTAVAIL
Errno::EADDRINUSE
Errno::EAFNOSUPPORT
Errno::EPFNOSUPPORT
Errno::EOPNOTSUPP
Errno::ESOCKTNOSUPPORT
Errno::EPROTONOSUPPORT
Errno::ENOPROTOOPT
Errno::EPROTOTYPE
Errno::EMSGSIZE
Errno::EDESTADDRREQ
Errno::ENOTSOCK
Errno::EUSERS
Errno::ESTRPIPE
Errno::ERESTART
Errno::EILSEQ
Errno::ELIBEXEC
Errno::ELIBMAX
Errno::ELIBSCN
Errno::ELIBBAD
Errno::ELIBACC
Errno::EREMCHG
Errno::EBADFD
Errno::ENOTUNIQ
Errno::EOVERFLOW
Errno::EBADMSG
Errno::EDOTDOT
Errno::EMULTIHOP
Errno::EPROTO
Errno::ECOMM
Errno::ESRMNT
Errno::EADV
Errno::ENOLINK
Errno::EREMOTE
Errno::ENOPKG
Errno::ENONET
Errno::ENOSR
Errno::ETIME
Errno::ENODATA
Errno::ENOSTR
Errno::EBFONT
Errno::EBADSLT
Errno::EBADRQC
Errno::ENOANO
Errno::EXFULL
Errno::EBADR
Errno::EBADE
Errno::EL2HLT
Errno::ENOCSI
Errno::EUNATCH
Errno::ELNRNG
Errno::EL3RST
Errno::EL3HLT
Errno::EL2NSYNC
Errno::ECHRNG
Errno::EIDRM
Errno::ENOMSG
Errno::ELOOP
Errno::ENOTEMPTY
Errno::ENOSYS
Errno::ENOLCK
Errno::ENAMETOOLONG
Errno::EDEADLK
Errno::ERANGE
Errno::EDOM
Errno::EPIPE
Errno::EMLINK
Errno::EROFS
Errno::ESPIPE
Errno::ENOSPC
Errno::EFBIG
Errno::ETXTBSY
Errno::ENOTTY
Errno::EMFILE
Errno::ENFILE
Errno::EINVAL
Errno::EISDIR
Errno::ENOTDIR
Errno::ENODEV
Errno::EXDEV
Errno::EEXIST
Errno::EBUSY
Errno::ENOTBLK
Errno::EFAULT
Errno::EACCES
Errno::ENOMEM
Errno::EAGAIN
IO::EAGAINWaitWritable
IO::EAGAINWaitReadable
Errno::ECHILD
Errno::EBADF
Errno::ENOEXEC
Errno::E2BIG
Errno::ENXIO
Errno::EIO
Errno::EINTR
Errno::ESRCH
Errno::ENOENT
Errno::EPERM
Errno::NOERROR
EncodingError
Encoding::ConverterNotFoundError
Encoding::InvalidByteSequenceError
Encoding::UndefinedConversionError
Encoding::CompatibilityError
RuntimeError
FrozenError
Gem::Exception
Gem::VerificationError
Gem::RubyVersionMismatch
Gem::RemoteSourceException
Gem::RemoteInstallationSkipped
Gem::RemoteInstallationCancelled
Gem::RemoteError
Gem::OperationNotSupportedError
Gem::InvalidSpecificationException
Gem::InstallError
Gem::RuntimeRequirementNotMetError
Gem::ImpossibleDependenciesError
Gem::GemNotFoundException
Gem::SpecificGemNotFoundException
Gem::FormatException
Gem::FilePermissionError
Gem::EndOfYAMLException
Gem::DocumentError
Gem::GemNotInHomeException
Gem::DependencyRemovalException
Gem::DependencyError
Gem::UnsatisfiableDependencyError
Gem::DependencyResolutionError
Gem::CommandLineError
RangeError
FloatDomainError
IndexError
StopIteration
ClosedQueueError
ArgumentError
UncaughtThrowError
Gem::Requirement::BadRequirementError
TypeError
SignalException
Interrupt
fatal
SystemExit
Gem::SystemExitException
MonitorMixin::ConditionVariable::Timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment