Throw bad req error instead

This commit is contained in:
Fang-Pen Lin
2025-11-25 08:57:29 -08:00
parent 9266dd1060
commit 928aa07efa
@@ -62,7 +62,7 @@ export const getDNSMadeEasyConnectionListItem = () => {
export const listDNSMadeEasyZones = async (appConnection: TDNSMadeEasyConnection): Promise<TDNSMadeEasyZone[]> => { export const listDNSMadeEasyZones = async (appConnection: TDNSMadeEasyConnection): Promise<TDNSMadeEasyZone[]> => {
if (appConnection.method !== DNSMadeEasyConnectionMethod.APIKeySecret) { if (appConnection.method !== DNSMadeEasyConnectionMethod.APIKeySecret) {
throw new Error("Unsupported DNS Made Easy connection method"); throw new BadRequestError({ message: "Unsupported DNS Made Easy connection method" });
} }
const { const {
@@ -123,7 +123,7 @@ export const listDNSMadeEasyRecords = async (
options: { zoneId: string; type?: string; name?: string } options: { zoneId: string; type?: string; name?: string }
): Promise<DNSMadeEasyApiResponse["data"]> => { ): Promise<DNSMadeEasyApiResponse["data"]> => {
if (appConnection.method !== DNSMadeEasyConnectionMethod.APIKeySecret) { if (appConnection.method !== DNSMadeEasyConnectionMethod.APIKeySecret) {
throw new Error("Unsupported DNS Made Easy connection method"); throw new BadRequestError({ message: "Unsupported DNS Made Easy connection method" });
} }
const { const {
credentials: { apiKey, secretKey } credentials: { apiKey, secretKey }
@@ -187,7 +187,7 @@ export const listDNSMadeEasyRecords = async (
export const validateDNSMadeEasyConnectionCredentials = async (config: TDNSMadeEasyConnectionConfig) => { export const validateDNSMadeEasyConnectionCredentials = async (config: TDNSMadeEasyConnectionConfig) => {
if (config.method !== DNSMadeEasyConnectionMethod.APIKeySecret) { if (config.method !== DNSMadeEasyConnectionMethod.APIKeySecret) {
throw new Error("Unsupported DNS Made Easy connection method"); throw new BadRequestError({ message: "Unsupported DNS Made Easy connection method" });
} }
const { apiKey, secretKey } = config.credentials; const { apiKey, secretKey } = config.credentials;