Files
starface-outlook-sync-addin/node_modules/tsyringe/dist/esm5/error-helpers.js
T
Stefan Hacker 37ad745546 first commit
2026-04-03 09:38:48 +02:00

18 lines
826 B
JavaScript

import { __read, __spread } from "tslib";
function formatDependency(params, idx) {
if (params === null) {
return "at position #" + idx;
}
var argName = params.split(",")[idx].trim();
return "\"" + argName + "\" at position #" + idx;
}
function composeErrorMessage(msg, e, indent) {
if (indent === void 0) { indent = " "; }
return __spread([msg], e.message.split("\n").map(function (l) { return indent + l; })).join("\n");
}
export function formatErrorCtor(ctor, paramIdx, error) {
var _a = __read(ctor.toString().match(/constructor\(([\w, ]+)\)/) || [], 2), _b = _a[1], params = _b === void 0 ? null : _b;
var dep = formatDependency(params, paramIdx);
return composeErrorMessage("Cannot inject the dependency " + dep + " of \"" + ctor.name + "\" constructor. Reason:", error);
}