Skip to content

Commit

Permalink
Fetch tool get (#2)
Browse files Browse the repository at this point in the history
* fix(fetchtool): catch fetch exception on get resource

* fix(fetchtool): update another fetch
  • Loading branch information
AndreyNikitin authored Dec 14, 2021
1 parent 33e6ddf commit d12fc4a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/FetchWorkerTool.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ const onMessage = ({data: job}) => {
jobsActive++;

fetch(job.url, job.options)
.then(response => response.arrayBuffer())
.then(result => {
if (result.ok) return result.arrayBuffer();
return Promise.reject(result.status);
})
.then(buffer => complete.push({id: job.id, buffer}))
.catch(error => complete.push({id: job.id, error}))
.then(() => jobsActive--);
Expand Down

0 comments on commit d12fc4a

Please sign in to comment.