0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

chore: add comments

This commit is contained in:
Darcy Ye 2024-03-25 17:25:02 +08:00
parent 9e67b670de
commit 614375589d
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610

View file

@ -350,6 +350,10 @@ export default function logtoConfigRoutes<T extends AuthedRouter>(
},
});
} catch (error: unknown) {
/**
* `ResponseError` comes from `@withtyped/client` and all `logto/core` API returns error in the
* format of `RequestError`, we manually transform it here to keep the error format consistent.
*/
if (error instanceof ResponseError) {
const { message } = z.object({ message: z.string() }).parse(await error.response.json());
throw new RequestError({ code: 'jwt_customizer.general', status: 422 }, { message });