mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 20:50:58 +00:00
refactor: standardize error handling across components by utilizing CustomApiError for improved error messaging
This commit is contained in:
@@ -19,3 +19,7 @@ export interface ComponentManifest {
|
||||
};
|
||||
spec: Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
}
|
||||
|
||||
export interface CustomApiError {
|
||||
msg?: string;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ export abstract class BaseHttpClient {
|
||||
// 错误处理
|
||||
protected handleError(error: object): never {
|
||||
if (axios.isCancel(error)) {
|
||||
throw { code: -2, message: 'Request canceled', data: null };
|
||||
throw { code: -2, msg: 'Request canceled', data: null };
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user