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

refactor(connector): use raw error for config guard (#1484)

This commit is contained in:
Gao Sun 2022-07-08 19:43:43 +08:00 committed by GitHub
parent a861f9fdff
commit 4d3941ee2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 12 additions and 12 deletions

View file

@ -53,7 +53,7 @@ export default class AlipayNativeConnector implements SocialConnector {
const result = alipayNativeConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -53,7 +53,7 @@ export default class AlipayConnector implements SocialConnector {
const result = alipayConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -28,7 +28,7 @@ export default class AliyunDmConnector implements EmailConnector {
const result = aliyunDmConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -23,7 +23,7 @@ export default class AliyunSmsConnector implements SmsConnector {
const result = aliyunSmsConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -42,7 +42,7 @@ export default class FacebookConnector implements SocialConnector {
const result = facebookConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -38,7 +38,7 @@ export default class GithubConnector implements SocialConnector {
const result = githubConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -40,7 +40,7 @@ export default class GoogleConnector implements SocialConnector {
const result = googleConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -29,7 +29,7 @@ export default class SendGridMailConnector implements EmailConnector {
const result = sendGridMailConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -23,7 +23,7 @@ export default class SmtpConnector implements EmailConnector {
const result = smtpConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -22,7 +22,7 @@ export default class TwilioSmsConnector implements SmsConnector {
const result = twilioSmsConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -42,7 +42,7 @@ export default class WechatNativeConnector implements SocialConnector {
const result = wechatNativeConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};

View file

@ -43,7 +43,7 @@ export default class WechatConnector implements SocialConnector {
const result = wechatConfigGuard.safeParse(config);
if (!result.success) {
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error.message);
throw new ConnectorError(ConnectorErrorCodes.InvalidConfig, result.error);
}
};