"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "interceptDatabaseError", {
    enumerable: true,
    get: function() {
        return interceptDatabaseError;
    }
});
const _containertokens = require("../container.tokens");
async function interceptDatabaseError(req, res, next) {
    const serverHost = req.container.resolve(_containertokens.DITokens.serverHost);
    const databaseReadyState = serverHost.hasConnected();
    if (databaseReadyState === 1) {
        next();
    } else {
        res.status(500);
        res.send({
            databaseReadyState: serverHost.hasConnected(),
            state: "Retrying mongo connection. Please contact the developer if this persists."
        });
    }
}

//# sourceMappingURL=database.js.map