"use strict";
/**
 * Fireblocks API
 * Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
 *
 * The version of the OpenAPI document: 1.6.2
 * Contact: developers@fireblocks.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleError = exports.FireblocksError = void 0;
var axios_1 = require("axios");
var fireblocksResponse_1 = require("../response/fireblocksResponse");
var FireblocksError = /** @class */ (function () {
    function FireblocksError(message, response, request) {
        this.message = message;
        this.response = response;
        this.request = request;
    }
    return FireblocksError;
}());
exports.FireblocksError = FireblocksError;
function handleError(error) {
    var _a;
    if ((0, axios_1.isAxiosError)(error)) {
        var errorMessage = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data.message) || error.message || "No response from server";
        var response = error.response ? (0, fireblocksResponse_1.convertToFireblocksResponse)(error.response) : undefined;
        return new FireblocksError(errorMessage, response, error.request);
    }
    return error;
}
exports.handleError = handleError;
//# sourceMappingURL=fireblocksError.js.map