Skip to content

Commit

Permalink
Merge pull request crabbly#508 from EstebanBorai/feat/error-with-xmlh…
Browse files Browse the repository at this point in the history
…ttpreq

Feature | Use the XMLHttpRequest instance as second param for `onError` callback
  • Loading branch information
crabbly authored Nov 7, 2020
2 parents c31460b + fb758c3 commit e42c350
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare namespace printJS {
css?: string | string[];
style?: string;
scanStyles?: boolean;
onError?: (error: any) => void;
onError?: (error: any, xmlHttpRequest?: XMLHttpRequest) => void;
onPrintDialogClose?: () => void;
onIncompatibleBrowser?: () => void;
base64?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/js/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {

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

// Since we don't have a pdf document available, we will stop the print job
})
Expand All @@ -30,7 +30,7 @@ export default {
// Check for errors
if ([200, 201].indexOf(req.status) === -1) {
cleanUp(params)
params.onError(req.statusText)
params.onError(req.statusText, req)

// Since we don't have a pdf document available, we will stop the print job
return
Expand Down

0 comments on commit e42c350

Please sign in to comment.