1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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-turso 2022-11-16 14:22:02 +02:00
parent 513e4a8193
commit 02dfbad307

View File

@ -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(