Add a helpful message when an error class passed to `and_raise` requires 1 or more initialization arguments #99

Closed
dchelimsky opened this Issue Jan 29, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@dchelimsky
Member

dchelimsky commented Jan 29, 2012

The and_raise method accepts either a class or an instance, but it only works with a class if the class has a zero-arg initializer.. Right now, when it receives a class with a non-zero-arg initializer the ArgumentError bubbles up, and is confusing for the end user.

and_raise should capture an ArgumentError and raise its own ArgumentError with helpful information as to how to fix the problem.

@coreyhaines

This comment has been minimized.

Show comment
Hide comment
@coreyhaines

coreyhaines Jan 29, 2012

Contributor

Hey, look, I'm pull request number 100!
#100

Always one to grab the spotlight!

Contributor

coreyhaines commented Jan 29, 2012

Hey, look, I'm pull request number 100!
#100

Always one to grab the spotlight!

@coreyhaines

This comment has been minimized.

Show comment
Hide comment
@coreyhaines

coreyhaines Jan 29, 2012

Contributor

Since my error message writing skills aren't always the best, I'm sure you'll want to adjust it to make it include more "helpful information as to how to fix the problem."

Contributor

coreyhaines commented Jan 29, 2012

Since my error message writing skills aren't always the best, I'm sure you'll want to adjust it to make it include more "helpful information as to how to fix the problem."

dchelimsky added a commit that referenced this issue Jan 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment