UNPKG

804 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class OclifLoadingHandler {
4 constructor(command) {
5 this.command = command;
6 }
7 async handle(message, value) {
8 try {
9 const ret = await value;
10 return ret;
11 }
12 catch (e) {
13 this.showError(`Error in "${message}": ${e}`);
14 throw e;
15 }
16 }
17 handleSync(message, value) {
18 try {
19 const ret = value();
20 return ret;
21 }
22 catch (e) {
23 this.showError(`Error in "${message}": ${e}`);
24 throw e;
25 }
26 }
27 showError(message) {
28 this.command.error(message);
29 }
30}
31exports.OclifLoadingHandler = OclifLoadingHandler;
32//# sourceMappingURL=OclifLoadingHandler.js.map
\No newline at end of file