Skip to content

Commit

Permalink
Remote print errors handling
Browse files Browse the repository at this point in the history
On remote print errors such as could not find the url. PrintJS does not handle the error
  • Loading branch information
sinandev authored Mar 16, 2020
1 parent 1fff274 commit e4faf1b
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 {
let 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 e4faf1b

Please sign in to comment.