"use strict";
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorUtils = void 0;
const objects_1 = require("../vs/base/common/objects");
var ErrorUtils;
(function (ErrorUtils) {
    function fromUnknown(error) {
        if (error instanceof Error) {
            return error;
        }
        if (typeof error === 'string') {
            return new Error(error);
        }
        return new Error(`An unexpected error occurred: ${(0, objects_1.safeStringify)(error)}`);
    }
    ErrorUtils.fromUnknown = fromUnknown;
    function toString(error) {
        return error.stack ? error.stack : error.message;
    }
    ErrorUtils.toString = toString;
})(ErrorUtils || (exports.ErrorUtils = ErrorUtils = {}));
//# sourceMappingURL=errors.js.map