Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Cancel download process ! #781

Open
Pardeep03315 opened this issue Oct 15, 2019 · 1 comment
Open

Error in Cancel download process ! #781

Pardeep03315 opened this issue Oct 15, 2019 · 1 comment

Comments

@Pardeep03315
Copy link

Hi , thanks for the awesome library .
I am using this library last 2 month ...its really awesome thanks for maintaining this .
.
.
.
I have an issue in cancel download process . I an cancelling download process by jobId created on download begin callback first time . by the following code .

RNFS.stopDownload(jobId).then((res)=>
{
console.log("Download Cancelled : "+JSON.stringify(res))
})
.catch((res)=>
{
console.log("Error : "+res)
})

But some error display in this method . Please suggest me ...is am i doing something wrong in logic ?? Please help
s

Here is the screenshot

@stebogit
Copy link

stebogit commented Aug 30, 2020

@Pardeep03315 RNFS.stopDownload does not return a promise (see docs and #37 and #355).

Also, for some reason the error is thrown at the RNFS.downloadFile level:

RNFS.downloadFile
  .promise
  .then((res) => {
    // all good
  })
  .catch((err) => {
    if (err.code === 'EUNSPECIFIED' && jobId === -1) return; // process was cancelled
    // else handle error
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants