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

fix: update safe browsing error messages #2101

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

halfwhole
Copy link
Collaborator

Problem

Safe browsing errors are not being logged and returned properly.

The returned error message looks like this, because response and response.body are objects:
Screenshot 2022-11-28 at 4 52 10 PM

The logged error message looks like this, because it's trying to log error instead of error.message:
Screenshot 2022-11-28 at 3 25 04 PM

Solution

  • Change the error message contents from response and response.body to body.error.message
  • Change the logged error message from error to error.message

Now, both the logged and returned error messages look like this:
Screenshot 2022-11-28 at 5 18 28 PM

For context, when calling the Safe Browsing API, the reponse JSON body looks something like this when there's an error:
Screenshot 2022-11-28 at 3 23 54 PM

The indentation changes from line 83/84 onwards in this PR are caused by prettier

Also, apologies to the team for unintentionally exposing the now-removed API key 🙇

Copy link
Contributor

@gweiying gweiying left a comment

Choose a reason for hiding this comment

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

lgtm! thanks for the catch

@halfwhole halfwhole merged commit d368f77 into develop Dec 7, 2022
@halfwhole halfwhole deleted the fix/safe-browsing-error-message branch December 7, 2022 08:41
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.

2 participants