mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 17:58:05 +00:00
@uppy/companion: remove error.extraData (#5198)
See discussion in #3832.
This commit is contained in:
parent
dceda79a97
commit
2f21ce99c9
2 changed files with 7 additions and 9 deletions
|
|
@ -18,6 +18,9 @@ These cover all the major Uppy versions and how to migrate to them.
|
|||
`getExtraGrantConfig`.
|
||||
- Endpoint `GET /s3/params` now returns `{ method: "POST" }` instead of
|
||||
`{ method: "post" }`. This will not affect most people.
|
||||
- The Companion [`error` event](https://uppy.io/docs/companion/#events) now no
|
||||
longer includes `extraData` inside the `payload.error` property. `extraData`
|
||||
is (and was also before) included in the `payload`.
|
||||
|
||||
### `@uppy/companion-client`
|
||||
|
||||
|
|
|
|||
|
|
@ -49,11 +49,7 @@ function sanitizeMetadata(inputMetadata) {
|
|||
}
|
||||
|
||||
class ValidationError extends Error {
|
||||
constructor(message) {
|
||||
super(message)
|
||||
|
||||
this.name = 'ValidationError'
|
||||
}
|
||||
name = 'ValidationError'
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -340,7 +336,7 @@ class Uploader {
|
|||
return
|
||||
}
|
||||
logger.error(err, 'uploader.error', this.shortToken)
|
||||
this.#emitError(err)
|
||||
await this.#emitError(err)
|
||||
} finally {
|
||||
emitter().removeAllListeners(`pause:${this.token}`)
|
||||
emitter().removeAllListeners(`resume:${this.token}`)
|
||||
|
|
@ -487,14 +483,13 @@ class Uploader {
|
|||
*/
|
||||
async #emitError(err) {
|
||||
// delete stack to avoid sending server info to client
|
||||
// todo remove also extraData from serializedErr in next major,
|
||||
// see PR discussion https://github.com/transloadit/uppy/pull/3832
|
||||
// @ts-ignore
|
||||
const { serializeError } = await import('serialize-error')
|
||||
const { stack, ...serializedErr } = serializeError(err)
|
||||
const dataToEmit = {
|
||||
action: 'error',
|
||||
// @ts-ignore
|
||||
payload: { ...err.extraData, error: serializedErr },
|
||||
payload: { error: serializedErr },
|
||||
}
|
||||
this.saveState(dataToEmit)
|
||||
emitter().emit(this.token, dataToEmit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue