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)`
|
||||
|
||||
* `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: ... } }`.
|
||||
|
|
|
@ -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 && 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.');
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue