Make route params available during error handler (Fixes #860) #895

Merged
merged 1 commit into from Jan 31, 2016

Conversation

Projects
None yet
4 participants
Contributor

jeremyevans commented Jun 27, 2014

This is kind of ugly, but I couldn't see a better way. One
potential issue is that the splat and captures route params
will be overwritten by the error handler. There's no way to
change that without breaking backwards compatibility. We
could potentially offer the route splat/captures under
different param names, though.

@jeremyevans jeremyevans Make route params available during error handler (Fixes #860)
This is kind of ugly, but I couldn't see a better way.  One
potential issue is that the splat and captures route params
will be overwritten by the error handler.  There's no way to
change that without breaking backwards compatibility.  We
could potentially offer the route splat/captures under
different param names, though.
10cc608
Owner

rkh commented Jun 28, 2014

I think I am in favour of this patch. Any opinions @kytrinyx, @zzak? Should the same behaviour be adapted for pattern-less before/after blocks?

Member

kytrinyx commented Jun 28, 2014

I'm inclined to agree. It would be really nice to have those handy at that time!

What would be the use-case for having them in the pattern-less before/after blocks?

Owner

rkh commented Jun 29, 2014

What would be the use-case for having them in the pattern-less before/after blocks?

Personally, I've never run into a use case, since then I could usually use a pattern with the filter. People seem to assume it should work, see for instance #417. However, after giving this some thought, I don't think we should do it, since it would only work for after filters.

Member

kytrinyx commented Jun 29, 2014

Agreed, let's not go down that path. I'm happy with this PR as is.

rkh added this to the 1.5.0 milestone Jun 30, 2014

zzak added the feature label Feb 6, 2015

@zzak zzak added a commit that referenced this pull request Jan 31, 2016

@zzak zzak Merge pull request #895 from jeremyevans/error-params
Make route params available during error handler (Fixes #860)
391a3c0

@zzak zzak merged commit 391a3c0 into sinatra:master Jan 31, 2016

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@zzak zzak added a commit that referenced this pull request Jan 31, 2016

@zzak zzak Add CHANGELOG for #895 [ci skip] cf732f2

@zzak zzak modified the milestone: 2.0.0, 1.5.0 Aug 21, 2016

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