mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-09 03:22:40 +00:00
refactor: share web login unavailable response
This commit is contained in:
@@ -47,6 +47,10 @@ function respondProviderUnsupported(respond: RespondFn, providerId: string) {
|
||||
);
|
||||
}
|
||||
|
||||
function respondWebLoginUnavailable(respond: RespondFn, err: unknown) {
|
||||
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)));
|
||||
}
|
||||
|
||||
/** Resolves a concrete provider gateway login method or sends the public error. */
|
||||
function resolveWebLoginRequest<TMethod extends WebLoginGatewayMethod>(params: {
|
||||
rawParams: unknown;
|
||||
@@ -129,7 +133,7 @@ export const webHandlers: GatewayRequestHandlers = {
|
||||
}
|
||||
respond(true, result, undefined);
|
||||
} catch (err) {
|
||||
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)));
|
||||
respondWebLoginUnavailable(respond, err);
|
||||
}
|
||||
},
|
||||
"web.login.wait": async ({ params, respond, context }) => {
|
||||
@@ -157,7 +161,7 @@ export const webHandlers: GatewayRequestHandlers = {
|
||||
}
|
||||
respond(true, result, undefined);
|
||||
} catch (err) {
|
||||
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, formatForLog(err)));
|
||||
respondWebLoginUnavailable(respond, err);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user