UNPKG

748 BJavaScriptView Raw
1"use strict";
2/*
3 * @adonisjs/ace
4 *
5 * (c) Harminder Virk <virk@adonisjs.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10Object.defineProperty(exports, "__esModule", { value: true });
11exports.handleError = void 0;
12const cliui_1 = require("@poppinss/cliui");
13/**
14 * Handles the command errors and prints them to the console.
15 */
16// eslint-disable-next-line no-shadow
17function handleError(error, callback) {
18 if (typeof callback === 'function') {
19 callback(error);
20 }
21 else if (typeof error.handle === 'function') {
22 error.handle(error);
23 }
24 else {
25 cliui_1.logger.fatal(error);
26 }
27}
28exports.handleError = handleError;