Skip to content

Improve error reporting to users #3247

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

Merged
merged 16 commits into from
Nov 14, 2017
Merged

Conversation

agjohnson
Copy link
Contributor

Rebase of #3244

self.run_build(record=record, docker=docker)
failure = self.setup_env.failure or self.build_env.failure
except Exception as e: # noqa
log.exception('Top-level build exception has been raised')
Copy link
Member

@safwanrahman safwanrahman Nov 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception should not be logged?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Seems like we should definitely be logging it..

Copy link
Member

@safwanrahman safwanrahman Nov 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericholscher Sorry, I could not explain it correctly.
I meant that this exception tracelog should not be reported to user.

Copy link
Member

@safwanrahman safwanrahman Nov 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can add extra information while sending the data to sentry so that its easier to track.

log.exception('Top-level build exception has been raised', extra={"project": pk, "build": build_pk)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think that's the plan now.

@agjohnson
Copy link
Contributor Author

Also, we talked a bit more on this. I'm pretty generally -1 on reporting tracebacks to users, so this should explore another method of giving us a way to reference the exception to the user without giving a traceback. We talked about using Sentry to reference a message that we apply a message id to. We can continue on this next week.

@ericholscher ericholscher force-pushed the improve-task-error-reporting branch from 3da4cc0 to 243f82a Compare November 13, 2017 23:02
@@ -421,7 +421,11 @@ def update_build(self, state=None):
self.build['error'] = str(self.failure)
else:
self.build['error'] = ugettext_noop(
"An unexpected error occurred")
"A failure in our code has occured. "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicks because apparently this is very commonly seen copy:

  • "failure" -> "error": failure is a state we apply, error is what we hit
  • "in our code" is very specific, where this can be any number of things we did. something more generic would be good here

Others:

"There was a problem with Read the Docs while building your documentation"
"We encountered an error with Read the Docs while building your documentation"

"An unexpected error occurred")
"A failure in our code has occured. "
"Please report this to us with your build id ({}).".format(
self.build['pk']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure best way to handle this. Interpolation on localized strings should happen outside gettext. The interpolated variable should be named as well.

# **Always** report build status.
# This can still fail if the API Is totally down, but should catch more failures
result = {}
error = 'Unknown error. Please include the build id ({}) in any bug reports.'.format(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "Unknown error" -> "Unknown error encountered"
  • Needs localization
  • Named variable for interpolation

'success': False,
'error': error,
}
result = api_v2.build(build_pk).patch(build_updates)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduce duplicated code to:

if hasattr(self, 'build'):
    build_updates = {...}
else:
    build_updates = {...}
return api_v2.build(build_pk).patch(build_updates)

@ericholscher ericholscher merged commit 1b6860a into master Nov 14, 2017
@stsewd stsewd deleted the improve-task-error-reporting branch August 15, 2018 22:14
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.

3 participants