Make error for invoking a functional global override more descriptive

Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-tursoandJanne Savolainen committed 2022-11-16 15:55:24 +02:00
1 parent 513e4a8193
commit 02dfbad307
1 file changed
+8 -2
@@ -9,10 +9,16 @@ import { camelCase } from "lodash/fp";
export const getGlobalOverrideForFunction = (
injectable: Injectable<Function, any, any>,
) =>
getGlobalOverride(injectable, () => (...args: any[]) => {
getGlobalOverride(injectable, (di) => (...args: any[]) => {
console.warn(
`Tried to invoke a function "${injectable.id}" without override. The args were:`,
`Tried to invoke a function "${injectable.id}" without override.`,
"\n\n",
"The args were:",
args,
"\n\n",
`The context was: "${di.context
.map((x) => x.injectable.id)
.join(" -> ")}"`,
);
throw new Error(