Merge pull request #5076 from betagouv/fix-file-upload-error-stacktraces

This commit is contained in:
Pierre de La Morinerie 2020-04-23 12:35:53 +02:00 committed by GitHub
commit d927118221
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,9 +20,19 @@ export const FAILURE_CONNECTIVITY = 'file-upload-failure-connectivity';
export default class FileUploadError extends Error {
constructor(message, status, code) {
super(message);
this.name = 'FileUploadError';
this.status = status;
this.code = code;
// Prevent the constructor stacktrace from being included.
// (it messes up with Sentry issues grouping)
if (Error.captureStackTrace) {
// V8-only
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack;
}
}
/**