@sentry/webpack-plugin
Advanced tools
Comparing version 1.7.0 to 1.8.0
# Changelog | ||
## v1.8.0 | ||
* feat: Add errorHandler option (#133) | ||
## v1.7.0 | ||
@@ -4,0 +8,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"author": "Sentry", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"license": "MIT", | ||
@@ -14,0 +14,0 @@ "repository": "git@github.com:getsentry/sentry-webpack-plugin.git", |
@@ -110,4 +110,5 @@ <p align="center"> | ||
* `silent [optional]` - `boolean`, if `true`, all logs are suppressed (useful for `--json` option) | ||
* `errorHandler [optional]` - `function(err: Error, invokeErr: function(): void): void`, when Cli error occurs, plugin calls this function. webpack compilation failure can be chosen by calling `invokeErr` callback or not. default `(err, invokeErr) => { invokeErr() }` | ||
You can find more information about these options in our official docs: | ||
https://docs.sentry.io/cli/releases/#sentry-cli-sourcemaps |
@@ -205,2 +205,26 @@ /*eslint-disable*/ | ||
}); | ||
test('handles errors with errorHandler option', done => { | ||
expect.assertions(3); | ||
mockCli.releases.new.mockImplementationOnce(() => | ||
Promise.reject(new Error('Pickle Rick')) | ||
); | ||
let e; | ||
const sentryCliPlugin = new SentryCliPlugin({ | ||
include: 'src', | ||
release: 42, | ||
errorHandler: err => { | ||
e = err; | ||
}, | ||
}); | ||
sentryCliPlugin.apply(compiler); | ||
setImmediate(() => { | ||
expect(compilation.errors).toEqual([]); | ||
expect(e.message).toEqual('Pickle Rick'); | ||
expect(compilationDoneCallback).toBeCalled(); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -207,0 +231,0 @@ |
@@ -301,3 +301,8 @@ const SentryCli = require('@sentry/cli'); | ||
finalizeRelease(compilation) { | ||
const { include } = this.options; | ||
const { | ||
include, | ||
errorHandler = (err, invokeErr) => { | ||
invokeErr(); | ||
}, | ||
} = this.options; | ||
@@ -317,3 +322,5 @@ if (!include) { | ||
.then(() => this.cli.releases.finalize(release)) | ||
.catch(err => addCompilationError(compilation, err.message)); | ||
.catch(err => | ||
errorHandler(err, () => addCompilationError(compilation, err.message)) | ||
); | ||
} | ||
@@ -320,0 +327,0 @@ |
32419
714
114