Page MenuHomeSoftware Heritage

Add a centralized error handler
ClosedPublic

Authored by jayeshv on Aug 31 2022, 12:00 PM.

Details

Summary

return the stack trace when the debug is set to True.
Log all the errors and send only the unknown ones to sentry.

Improve error messages.

Related to T4300

Diff Detail

Repository
rDGQL GraphQL API
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D8356 (id=30165)

Rebasing onto 4478a533a9...

Current branch diff-target is up to date.
Changes applied before test
commit fd5e172270f81b04b0171ce03f7b0d3fb2f053f4
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Wed Aug 31 11:40:24 2022 +0200

    Add a centralized error handler
    
    return the stack trace when the debug is set to True.
    Log all the errors and send only the unknown ones to  sentry.
    
    Related to T4300

See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/140/ for more details.

jayeshv added inline comments.
swh/graphql/errors/handlers.py
24

@ardumont I would like to send only these errors to sentry, I hope just a raise here will do the trick

jayeshv retitled this revision from [WIP] Add a centralized error handler to Add a centralized error handler.Aug 31 2022, 1:47 PM
jayeshv edited the summary of this revision. (Show Details)

Build is green

Patch application report for D8356 (id=30166)

Rebasing onto 4478a533a9...

Current branch diff-target is up to date.
Changes applied before test
commit 7c26384ac4e99aad7ada6fe7693776b2284644b1
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Wed Aug 31 11:40:24 2022 +0200

    Add a centralized error handler
    
    return the stack trace when the debug is set to True.
    Log all the errors and send only the unknown ones to  sentry.
    
    Improve error messages.
    
    Related to T4300

See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/141/ for more details.

Build is green

Patch application report for D8356 (id=30167)

Rebasing onto 4478a533a9...

Current branch diff-target is up to date.
Changes applied before test
commit 8c413e26dc33e3184f3439fadf9042a38f7de082
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Wed Aug 31 11:40:24 2022 +0200

    Add a centralized error handler
    
    return the stack trace when the debug is set to True.
    Log all the errors and send only the unknown ones to  sentry.
    
    Improve error messages.
    
    Related to T4300

See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/142/ for more details.

Build is green

Patch application report for D8356 (id=30181)

Rebasing onto 4478a533a9...

Current branch diff-target is up to date.
Changes applied before test
commit 1a506e1e20b943960f4c9b1e4196b0a3a37d7321
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Wed Aug 31 11:40:24 2022 +0200

    Add a centralized error handler
    
    return the stack trace when the debug is set to True.
    Log all the errors and send only the unknown ones to  sentry.
    
    Improve error messages.
    
    Related to T4300

See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/143/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me.

swh/graphql/errors/handlers.py
24

Use this instead:

if type(error.original_error) not in expected_errors:
swh/graphql/resolvers/scalars.py
54–55

This block is redundant with the one below, I think you can remove it.

This revision is now accepted and ready to land.Aug 31 2022, 3:44 PM
jayeshv added inline comments.

Build is green

Patch application report for D8356 (id=30184)

Rebasing onto 4478a533a9...

Current branch diff-target is up to date.
Changes applied before test
commit cae785639016cbf85e8e13c50f03ff89f93482dc
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Wed Aug 31 11:40:24 2022 +0200

    Add a centralized error handler
    
    return the stack trace when the debug is set to True.
    Log all the errors and send only the unknown ones to  sentry.
    
    Improve error messages.
    
    Related to T4300

See https://jenkins.softwareheritage.org/job/DGQL/job/tests-on-diff/144/ for more details.

This revision was automatically updated to reflect the committed changes.
jayeshv marked an inline comment as done.