8000 feat: allow omitting submitURL when uploadToServer is false by trop[bot] · Pull Request #28283 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: allow omitting submitURL when uploadToServer is false #28283

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/api/crash-reporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ The `crashReporter` module has the following methods:
### `crashReporter.start(options)`

* `options` Object
* `submitURL` String - URL that crash reports will be sent to as POST.
* `submitURL` String (optional) - URL that crash reports will be sent to as
POST. Required unless `uploadToServer` is `false`.
* `productName` String (optional) - Defaults to `app.name`.
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
`{ globalExtra: { _companyName: ... } }`.
Expand Down
4 changes: 2 additions & 2 deletions lib/browser/api/crash-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class CrashReporter {
extra = {},
globalExtra = {},
ignoreSystemCrashHandler = false,
submitURL,
submitURL = '',
uploadToServer = true,
rateLimit = false,
compress = true
} = options || {};

if (submitURL == null) throw new Error('submitURL is a required option to crashReporter.start');
if (uploadToServer && !submitURL) throw new Error('submitURL must be specified when uploadToServer is true');

if (!compress) {
deprecate.log('Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.');
Expand Down
8 changes: 7 additions & 1 deletion spec-main/api-crash-reporter-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,13 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
it('requires that the submitURL option be specified', () => {
expect(() => {
crashReporter.start({} as any);
}).to.throw('submitURL is a required option to crashReporter.start');
}).to.throw('submitURL must be specified when uploadToServer is true');
});

it('allows the submitURL option to be omitted when uploadToServer is false', () => {
expect(() => {
crashReporter.start({ uploadToServer: false } as any);
}).not.to.throw();
});

it('can be called twice', async () => {
Expand Down
0