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

Improve create-report-index error reporting #21

Merged
merged 1 commit into from
Jan 4, 2021
Merged

Improve create-report-index error reporting #21

merged 1 commit into from
Jan 4, 2021

Conversation

thibaudcolas
Copy link
Contributor

@thibaudcolas thibaudcolas commented Jan 4, 2021

I was trying out this project and stumbled upon this small thing – hope it helps! Currently create-report-index only logs error: undefined when it fails:

2021-01-04T14:59:53.649Z error: 	undefined

Changes

This change makes it log the error’s type and message, as well as the full stack trace. Sample output:

2021-01-04T15:01:15.332Z error: 	TypeError: Cannot read property '1' of null
TypeError: Cannot read property '1' of null
    at /cfgov-lighthouse/scripts/lib/reports.js:81:25
    at Array.map (<anonymous>)
    at processManifestRuns (/cfgov-lighthouse/scripts/lib/reports.js:76:15)
    at reducer (/cfgov-lighthouse/scripts/create-reports-index.js:59:27)
    at async /cfgov-lighthouse/scripts/create-reports-index.js:68:19

Testing

Manually add a throw new Error() somewhere inside the create-reports-index logic, and watch the command’s output before/after this change.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the development playbook
  • Passes all existing automated tests
  • Any change in functionality is tested
  • [ ] New functions are documented (with a description, list of inputs, and expected output)
  • [ ] Placeholder code is flagged / future todos are captured in comments
  • [ ] Visually tested in supported browsers and devices (see checklist below 👇)
  • [ ] Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • [ ] Reviewers requested with the Reviewers tool ➡️

Testing checklist

Browsers

N/A

Accessibility

N/A

Other

  • [ ] Is useable without CSS
  • [ ] Is useable without JS
  • [ ] Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

Currently `create-report-index` only logs `error: undefined` when it fails:

```
2021-01-04T14:59:53.649Z error: 	undefined
```

This change makes it log the error’s type and message, as well as the full stack trace. Sample output:

```
2021-01-04T15:01:15.332Z error: 	TypeError: Cannot read property '1' of null
TypeError: Cannot read property '1' of null
    at /cfgov-lighthouse/scripts/lib/reports.js:81:25
    at Array.map (<anonymous>)
    at processManifestRuns (/cfgov-lighthouse/scripts/lib/reports.js:76:15)
    at reducer (/cfgov-lighthouse/scripts/create-reports-index.js:59:27)
    at async /cfgov-lighthouse/scripts/create-reports-index.js:68:19
```
@contolini
Copy link
Member

Hey thanks @thibaudcolas!

@contolini contolini merged commit 4a94929 into cfpb:main Jan 4, 2021
@thibaudcolas thibaudcolas deleted the patch-2 branch January 4, 2021 16:55
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.

None yet

2 participants