Skip to content

Instantly share code, notes, and snippets.

@gmcabrita
Created May 13, 2023 18:48
Show Gist options
  • Save gmcabrita/34e1c12500672146833c1d6ddfae94e1 to your computer and use it in GitHub Desktop.
Save gmcabrita/34e1c12500672146833c1d6ddfae94e1 to your computer and use it in GitHub Desktop.

Ruby exception inheritance

module Phlex
  Error = Module.new

  NameError = Class.new(NameError) { include Error }
  ArgumentError = Class.new(ArgumentError) { include Error }
  StandardError = Class.new(StandardError) { include Error }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment