Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Centralize call to handle_error() #20

Open
lifeBCE opened this issue Jun 17, 2014 · 1 comment
Open

Enhancement: Centralize call to handle_error() #20

lifeBCE opened this issue Jun 17, 2014 · 1 comment

Comments

@lifeBCE
Copy link

lifeBCE commented Jun 17, 2014

erics-mbp:CloudMux ericthompson$ grep -nr handle_error app/* | wc -l
 339

There are currently 339 calls to handle_error() throughout all resource APIs. We can improve this significantly by removing potentially a couple thousand lines of code from all resource APIs that define their own exception handling block and make a call to handle_error() and by adding a global error handler to ResourceApiBase.

error do
    handle_error(env['sinatra.error'])
end

This method would be executed any time an exception is raised from a route block or a filter. This means we should be able to remove all exception handlers (begin...rescue) from all resource APIs and allow any exception to bubble up to error() in ResourceApiBase.

http://www.sinatrarb.com/intro.html#Error

@cstewart87
Copy link
Member

👍 This sounds awesome

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 a pull request may close this issue.

2 participants