"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.respondWithError = respondWithError;
const errors_1 = require("../providers/chain-state/external/adapters/errors");
function respondWithError(res, err) {
    if (err instanceof errors_1.AllProvidersUnavailableError) {
        return res.status(503).json({ error: 'All indexed API providers unavailable', message: err.message });
    }
    if (err instanceof errors_1.AdapterError && err.code === errors_1.AdapterErrorCode.INVALID_REQUEST) {
        return res.status(400).json({ error: 'Invalid request', message: err.message });
    }
    return res.status(500).send(err.message || err);
}
//# sourceMappingURL=apiUtils.js.map