1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-turso 2023-03-24 11:18:49 +02:00
parent 5716e5abcc
commit a4fab188ec
4 changed files with 18 additions and 1 deletions

View File

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

View File

@ -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",