mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
WIP
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
5716e5abcc
commit
a4fab188ec
@ -0,0 +1,17 @@
|
|||||||
|
import { getFailure, getSuccess } from "../call-result/call-result";
|
||||||
|
import { pipeline } from "@ogre-tools/fp";
|
||||||
|
|
||||||
|
export const withNoThrownErrors =
|
||||||
|
<TValue, TArgs extends unknown[]>(
|
||||||
|
toBeDecorated: (...args: TArgs) => TValue
|
||||||
|
) =>
|
||||||
|
(...args: TArgs) => {
|
||||||
|
try {
|
||||||
|
return pipeline(
|
||||||
|
toBeDecorated(...args),
|
||||||
|
getSuccess,
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
return getFailure(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -23,7 +23,7 @@ import logErrorInjectable, {
|
|||||||
} from "../../../common/log-error.injectable";
|
} from "../../../common/log-error.injectable";
|
||||||
|
|
||||||
import type { AppEvent } from "../../../common/app-event-bus/event-bus";
|
import type { AppEvent } from "../../../common/app-event-bus/event-bus";
|
||||||
import { getFailure, getSuccess } from "./call-result/call-result";
|
import { getFailure, getSuccess } from "./error-handling/call-result/call-result";
|
||||||
|
|
||||||
const telemetryDecoratorInjectable = getInjectable({
|
const telemetryDecoratorInjectable = getInjectable({
|
||||||
id: "telemetry-decorator",
|
id: "telemetry-decorator",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user