mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
refactor(northflank): implement custom SecretSyncError for improved error handling in Northflank API calls
This commit is contained in:
@@ -4,6 +4,7 @@ import { request } from "@app/lib/config/request";
|
||||
import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";
|
||||
import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
|
||||
|
||||
import { SecretSyncError } from "../secret-sync-errors";
|
||||
import { TNorthflankSyncWithCredentials } from "./northflank-sync-types";
|
||||
|
||||
const NORTHFLANK_API_URL = "https://api.northflank.com";
|
||||
@@ -78,7 +79,10 @@ const getNorthflankSecrets = async (secretSync: TNorthflankSyncWithCredentials):
|
||||
|
||||
return variables;
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Failed to fetch Northflank secrets. ${buildNorthflankAPIErrorMessage(error)}`);
|
||||
throw new SecretSyncError({
|
||||
error,
|
||||
message: `Failed to fetch Northflank secrets. ${buildNorthflankAPIErrorMessage(error)}`
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -109,7 +113,10 @@ const updateNorthflankSecrets = async (
|
||||
}
|
||||
);
|
||||
} catch (error: unknown) {
|
||||
throw new Error(`Failed to update Northflank secrets. ${buildNorthflankAPIErrorMessage(error)}`);
|
||||
throw new SecretSyncError({
|
||||
error,
|
||||
message: `Failed to update Northflank secrets. ${buildNorthflankAPIErrorMessage(error)}`
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user