Skip to content

Cannot catch some errors (Uncaught (in promise) DetailedError: tus: ...) #808

@sneko

Description

@sneko

Describe the bug

My Tus server with its onUploadFinish hook will save a successful upload into the database and will wipe out the file locally. The thing is the user, on the frontend, may need to remove it from its list using:

uppy.removeFile(file.id);

But it triggers the error:

Uncaught (in promise) DetailedError: tus: unexpected response while terminating upload, originated from request (method: DELETE, url: http://localhost:3000/api/upload/9a029a4f-ddf0-46c5-a52d-c281e0ef2e2b, response code: 404, response text: The file for this url was not found
, request id: n/a)

Originally triggered from

tus-js-client/lib/upload.ts

Lines 1199 to 1204 in fe0cf9e

throw new DetailedError(
'tus: unexpected response while terminating upload',
undefined,
req,
res,
)
.

The error 404 is part of the protocol so it's fine. I'm just here about the fact it's uncaught despite using Uppy listener on error event, and also using:

  uppy.use(Tus, {
    ...
    onError: (error) => {
      console.log(error);
    },
  });

Nothing from tus-js-client (and @uppy/tus using same parameters) is catching it.

To Reproduce

Use an Uppy with Tus plugin, and trigger uppy.removeFile(id) that will call the terminate() from tus-js-client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions