Skip to content

Instantly share code, notes, and snippets.

@mcgain
Created September 10, 2012 23:37
Show Gist options
  • Select an option

  • Save mcgain/3694817 to your computer and use it in GitHub Desktop.

Select an option

Save mcgain/3694817 to your computer and use it in GitHub Desktop.
terse exception creation
def new_exception(exception_name)
klass = Class.new Exception
Object.const_set exception_name.to_s, klass
end
new_exception "CannotFindPants"
new_exception :FlobbetsAreFlumoxed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment