mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
5716e5abcc
commit
a4fab188ec
4 files changed
+18
-1
No files matched your search
File renamed without changes.
File renamed without changes.
+17
@@ -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",
|
||||||
|
|||||||
Reference in new issue
Block a user