windsor-bot 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/printing/index.js +19 -10
- package/package.json +1 -1
package/dist/printing/index.js
CHANGED
|
@@ -9,16 +9,25 @@ export class PrinterUnavailableError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function isUnavailableError(error) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
code === '
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
let current = error;
|
|
13
|
+
for (let depth = 0; depth < 4 && current; depth++) {
|
|
14
|
+
if (!(current instanceof Error))
|
|
15
|
+
return false;
|
|
16
|
+
const code = 'code' in current ? String(current.code) : '';
|
|
17
|
+
const message = `${current.name} ${current.message}`.toLowerCase();
|
|
18
|
+
if (code === 'ENOENT' ||
|
|
19
|
+
code === 'ENODEV' ||
|
|
20
|
+
code === 'ENXIO' ||
|
|
21
|
+
message.includes('enoent') ||
|
|
22
|
+
message.includes('no such file or directory') ||
|
|
23
|
+
message.includes('printer or class does not exist') ||
|
|
24
|
+
message.includes('no printer') ||
|
|
25
|
+
message.includes('device or resource busy')) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
current = 'cause' in current ? current.cause : undefined;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
22
31
|
}
|
|
23
32
|
export async function printJob(job) {
|
|
24
33
|
const cfg = getCurrentConfig();
|