Skip to content

Enhancement: Centralize call to handle_error() #20

@lifeBCE

Description

@lifeBCE
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions