feat: allow omitting submitURL when uploadToServer is false (#28105)
This commit is contained in:
parent
f35fc93080
commit
502d4c19ce
3 changed files with 11 additions and 4 deletions
|
@ -77,7 +77,8 @@ The `crashReporter` module has the following methods:
|
||||||
### `crashReporter.start(options)`
|
### `crashReporter.start(options)`
|
||||||
|
|
||||||
* `options` Object
|
* `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`.
|
* `productName` String (optional) - Defaults to `app.name`.
|
||||||
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
|
* `companyName` String (optional) _Deprecated_ - Deprecated alias for
|
||||||
`{ globalExtra: { _companyName: ... } }`.
|
`{ globalExtra: { _companyName: ... } }`.
|
||||||
|
|
|
@ -10,13 +10,13 @@ class CrashReporter {
|
||||||
extra = {},
|
extra = {},
|
||||||
globalExtra = {},
|
globalExtra = {},
|
||||||
ignoreSystemCrashHandler = false,
|
ignoreSystemCrashHandler = false,
|
||||||
submitURL,
|
submitURL = '',
|
||||||
uploadToServer = true,
|
uploadToServer = true,
|
||||||
rateLimit = false,
|
rateLimit = false,
|
||||||
compress = true
|
compress = true
|
||||||
} = options || {};
|
} = 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 && uploadToServer) {
|
if (!compress && uploadToServer) {
|
||||||
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.');
|
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.');
|
||||||
|
|
|
@ -361,7 +361,13 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
||||||
it('requires that the submitURL option be specified', () => {
|
it('requires that the submitURL option be specified', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
crashReporter.start({} as any);
|
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 () => {
|
it('can be called twice', async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue