Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ruby Argument Error with Custom Message

If you want to raise an argument error with a clearer message

def process_thing(account: nil, thing: nil)
  raise("processing requires an account")) if account.blank?
  raise("Must have a Thing to process")) if thing.blank?
  # ... Do the actual work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.