0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(core): error message interpolation (#465)

This commit is contained in:
IceHe.xyz 2022-03-29 21:47:12 +08:00 committed by GitHub
parent e297dcbb33
commit f260d2bb56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 3 deletions

View file

@ -151,7 +151,7 @@ describe('getConnectorInstanceByType', () => {
test('should throw when there is no enabled connector existing in DB', async () => { test('should throw when there is no enabled connector existing in DB', async () => {
const type = ConnectorType.SMS; const type = ConnectorType.SMS;
await expect(getConnectorInstanceByType(type)).rejects.toMatchError( await expect(getConnectorInstanceByType(type)).rejects.toMatchError(
new RequestError('connector.not_found', { type }) new RequestError({ code: 'connector.not_found', type })
); );
}); });
}); });

View file

@ -87,7 +87,7 @@ export const getConnectorInstanceByType = async <T extends ConnectorInstance>(
); );
if (!connector) { if (!connector) {
throw new RequestError('connector.not_found', { type }); throw new RequestError({ code: 'connector.not_found', type });
} }
return connector; return connector;

View file

@ -27,7 +27,7 @@ const getConnector = async (connectorId: string) => {
throw new RequestError({ throw new RequestError({
code: 'session.invalid_connector_id', code: 'session.invalid_connector_id',
status: 422, status: 422,
data: { connectorId }, connectorId,
}); });
} }
throw error; throw error;

View file

@ -35,6 +35,7 @@ jest.mock('@/lib/social', () => ({
throw new RequestError({ throw new RequestError({
code: 'session.invalid_connector_id', code: 'session.invalid_connector_id',
status: 422, status: 422,
connectorId,
}); });
} }