diff --git a/packages/core/pipeline/src/utils/util.request.ts b/packages/core/pipeline/src/utils/util.request.ts index 205fe2edf..b5c341c04 100644 --- a/packages/core/pipeline/src/utils/util.request.ts +++ b/packages/core/pipeline/src/utils/util.request.ts @@ -16,6 +16,11 @@ export class HttpError extends Error { return; } super(error.message); + + if (error?.message?.indexOf("ssl3_get_record:wrong version number") > -1) { + this.message = "http协议错误,服务端要求http协议,请检查是否使用了https请求"; + } + this.name = error.name; this.code = error.code; this.cause = error.cause; diff --git a/packages/ui/certd-client/src/api/service.ts b/packages/ui/certd-client/src/api/service.ts index c69442c23..412b35cab 100644 --- a/packages/ui/certd-client/src/api/service.ts +++ b/packages/ui/certd-client/src/api/service.ts @@ -1,7 +1,7 @@ import axios from "axios"; import { get } from "lodash-es"; import Adapter from "axios-mock-adapter"; -import { errorLog, errorCreate } from "./tools"; +import { errorLog, errorCreate, response } from "./tools"; import { env } from "/src/utils/util.env"; import { useUserStore } from "../store/modules/user"; /** @@ -96,6 +96,10 @@ function createService() { const userStore = useUserStore(); userStore.logout(); } + + if (error?.config?.onError) { + error.config.onError(error); + } return Promise.reject(error); } ); diff --git a/packages/ui/certd-client/src/api/tools.ts b/packages/ui/certd-client/src/api/tools.ts index ccf032d44..85ed157e0 100644 --- a/packages/ui/certd-client/src/api/tools.ts +++ b/packages/ui/certd-client/src/api/tools.ts @@ -55,6 +55,9 @@ export function errorLog(error: any) { if (error.response?.data?.message) { message = error.response.data.message; } + if (message.indexOf("ssl3_get_record:wrong version number" > -1)) { + message = "http协议错误,服务端要求http协议,请检查是否使用了https请求"; + } // 显示提示 uiContext.get().notification.error({ message }); } diff --git a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue index 6634e09a8..93ce220b8 100644 --- a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue +++ b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue @@ -13,13 +13,21 @@ const emit = defineEmits<{ }>(); const optionsRef = ref([]); +const message = ref(""); const getOptions = async () => { - return await doRequest({ - type: props.type, - typeName: props.typeName, - action: props.action, - input: props.form - }); + return await doRequest( + { + type: props.type, + typeName: props.typeName, + action: props.action, + input: props.form + }, + { + onError(err) { + message.value = err.message; + } + } + ); }; const filterOption = (input: string, option: any) => { @@ -53,7 +61,8 @@ watch( diff --git a/packages/ui/certd-client/src/components/plugins/lib/index.ts b/packages/ui/certd-client/src/components/plugins/lib/index.ts index 5b6c47594..b338d562c 100644 --- a/packages/ui/certd-client/src/components/plugins/lib/index.ts +++ b/packages/ui/certd-client/src/components/plugins/lib/index.ts @@ -14,7 +14,7 @@ export type RequestHandleReq = { input: T; }; -export async function doRequest(req: RequestHandleReq) { +export async function doRequest(req: RequestHandleReq, opts?: any = {}) { const url = req.type === "access" ? "/pi/handle/access" : "/pi/handle/plugin"; const { typeName, action, data, input } = req; const res = await request({ @@ -25,7 +25,8 @@ export async function doRequest(req: RequestHandleReq) { action, data, input - } + }, + ...opts }); return res; } diff --git a/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue b/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue index ebbf8636f..94e2c1497 100644 --- a/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue +++ b/packages/ui/certd-client/src/components/plugins/synology/device-id-getter.vue @@ -1,7 +1,7 @@