mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove more nesting
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> Co-authored-by: Gabriel <gaccettola@mirantis.com>
This commit is contained in:
parent
d47de73555
commit
2d8b4fcd78
@ -50,29 +50,31 @@ const telemetryDecoratorInjectable = getInjectable({
|
|||||||
|
|
||||||
const whiteListed = whiteListMap.get(currentContext.injectable.id);
|
const whiteListed = whiteListMap.get(currentContext.injectable.id);
|
||||||
|
|
||||||
if (whiteListed) {
|
if (!whiteListed) {
|
||||||
let params;
|
return instance(...args);
|
||||||
|
|
||||||
try {
|
|
||||||
params = whiteListed.getParams(...args);
|
|
||||||
} catch (e) {
|
|
||||||
params = {
|
|
||||||
error:
|
|
||||||
"Tried to produce params for telemetry, but getParams() threw an error",
|
|
||||||
};
|
|
||||||
|
|
||||||
logError(
|
|
||||||
`Tried to produce params for telemetry of "${currentContext.injectable.id}", but getParams() threw an error`,
|
|
||||||
e
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
emitTelemetry({
|
|
||||||
action: currentContext.injectable.id,
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let params;
|
||||||
|
|
||||||
|
try {
|
||||||
|
params = whiteListed.getParams(...args);
|
||||||
|
} catch (e) {
|
||||||
|
params = {
|
||||||
|
error:
|
||||||
|
"Tried to produce params for telemetry, but getParams() threw an error",
|
||||||
|
};
|
||||||
|
|
||||||
|
logError(
|
||||||
|
`Tried to produce params for telemetry of "${currentContext.injectable.id}", but getParams() threw an error`,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
emitTelemetry({
|
||||||
|
action: currentContext.injectable.id,
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
|
||||||
return instance(...args);
|
return instance(...args);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user