UNPKG

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