Skip to content

Commit d2bf829

Browse files
refactor: remove throws from error handling to preserve original behaviour
1 parent cad5c63 commit d2bf829

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/web/src/services/commandApi.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import axios from "axios";
2-
import { apiErrorHandler } from "./errorHandler";
32

43
export const commandApi = {
54
getCommand: async (leafUrl: string): Promise<any> => {
@@ -99,11 +98,7 @@ export const commandApi = {
9998
arg: string;
10099
},
101100
): Promise<any> => {
102-
try {
103-
const response = await axios.post(subresourceUrl, data);
104-
return response.data;
105-
} catch (err: any) {
106-
apiErrorHandler.handleApiError(err, "Failed to create subresource");
107-
}
101+
const response = await axios.post(subresourceUrl, data);
102+
return response.data;
108103
},
109104
} as const;

src/web/src/services/errorHandler.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,4 @@ export const apiErrorHandler = {
1111
isHttpError: (err: any, statusCode: number): boolean => {
1212
return err.response?.status === statusCode;
1313
},
14-
15-
handleApiError: (err: any, context: string = ""): never => {
16-
console.error(context, err);
17-
const message = apiErrorHandler.getErrorMessage(err);
18-
throw new Error(message);
19-
},
2014
} as const;

0 commit comments

Comments
 (0)