Skip to content

Conversation

@robertopedroso
Copy link
Contributor

As requested in #450, this PR adds the with syntax to rescue_from and error_formatter:

rescue_from ArgumentError, with: rescue_argument_error
error_formatter :custom, with: CustomFormatter

But retains backwards-compatibility:

rescue_from ArgumentError do |e|
  ...
end

error_formatter :custom, lambda {|...| ... }

@dblock
Copy link
Member

dblock commented Aug 7, 2013

Good. Do you think we should change the documentation to reflect the with: syntax? IMO this creates a better way to extend the DSL with additional options moving forward. Can you make that change if you agree?

dblock added a commit that referenced this pull request Aug 7, 2013
Specify rescue handlers and error formatters using a hash
@dblock dblock merged commit 723cc3c into ruby-grape:master Aug 7, 2013
@robertopedroso robertopedroso deleted the rescue-with-method branch August 8, 2013 02:33
@robertopedroso
Copy link
Contributor Author

I agree that the documentation should be updated. I'll push commits for the YARD documentation in the morning. Should I also document this syntax in README.md?

@dblock
Copy link
Member

dblock commented Aug 8, 2013

Yes, please. README in general is much more important than the inline doc IMO, but I am sure many people feel otherwise.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants