- [x] Add `electron-unhandled` dependency:
- ~~Ensures errors are normalized~~ (disabled to prevent serializing non-errors that are thrown and leaking information)
- Distinguishes between main and renderer processes
- Allows suppression of error dialog
- [x] Log uncaught errors and unhandled promise rejections in main process
- [x] Tested using unguarded `throw new TyperError(…)` and `Promise.reject(…)` in `setTimeout` after `app` `ready` event.
- [x] Extract `Privacy` module that centralizes how we redact sensitive information such as phone numbers, group IDs, and user file paths.
- [x] Add `eslint-plugin-mocha` to disallow exclusive tests using `*.only`.
Fixes#2019.
Allows errors to be formatted and sanitized for logging. Removes sensitive paths
such as the app root directory.
Ideally, this module would be called singular `Error` but that is already a
global name. Using `Errors` plural is similar to Java convention for utilities
such as `Arrays`, `Collections`, `Files`, etc. See:
https://stackoverflow.com/a/11673838
In anticipation of GitHub’s deprecation of anonymous gists, we are moving our debug logs to https://debuglogs.org.
- [x] Publish debug logs to debuglogs.org.
- [x] Rename **Help > File a Bug** to **Report an Issue** for consistency with our debug log view as well as other apps such as Google Chrome.
- [x] Quickfix: Ensure `window.isFocused` always returns a boolean.
**Sample log:** https://debuglogs.org/0272bdd35288ed839ede88938a5290011150d42b56599efb5dd93ac80a2ac915
The plan is to use this for our future HTTP needs as it is:
- modern
- promise based
- popular
- likely to support custom certificate authorities (CAs)
Chosen over the following alternatives:
- superagent (older, promises added later, potential lack of custom CA support)
- axios (no team experience with it; less popular than `got`)
- request (older, heavy-weight, promises not native)
- jQuery (old, trying to move away from jQuery altogether and move towards
declarative UIs)
- `fetch` (too low-level, no native timeout support)
This makes it more consistent with ‘Report an issue’ under View > Debug Log.
Not using ellipsis as menu item doesn’t require user confirmation:
https://stackoverflow.com/a/637708
- [x] Apply ESLint autofixes in preparation of changes to debug log publish change.
- [x] Remove now unnecessary `/* eslint-env browser */` directives from some files. This is now part of our per-folder ESLint configuration.
Manual changes: 77cc9b61c9..0cf64f5083