| 1234567891011121314151617 |
- 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);
- }
|