"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensureHttpError = ensureHttpError;
const HttpErrorUtil_1 = require("../errors/HttpErrorUtil");
/**
 * Makes sure that if the given function rejects with an error,
 * an {@link HttpError} will be used.
 */
async function ensureHttpError(fn) {
    try {
        return await fn();
    }
    catch (error) {
        throw (0, HttpErrorUtil_1.toHttpError)(error);
    }
}
//# sourceMappingURL=HandlerUtil.js.map