Skip to content

Commit

Permalink
Merge pull request #422 from sinandev/remote_error_fix
Browse files Browse the repository at this point in the history
Remote print errors handling
  • Loading branch information
crabbly authored Sep 16, 2020
2 parents 0be563c + e4faf1b commit 061d1a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/js/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export default {
const req = new window.XMLHttpRequest()
req.responseType = 'arraybuffer'

req.addEventListener('error',() =>{
cleanUp(params)
params.onError(req.statusText)

// Since we don't have a pdf document available, we will stop the print job
return
});

req.addEventListener('load', () => {
// Check for errors
if ([200, 201].indexOf(req.status) === -1) {
Expand Down

0 comments on commit 061d1a4

Please sign in to comment.