From 3e5b90a0bfa8534ea3bcd8dfd21d6a5e1fd132e5 Mon Sep 17 00:00:00 2001 From: David Mihalcik Date: Mon, 14 Oct 2024 15:25:05 -0400 Subject: [PATCH] fmt --- lib/src/access.ts | 13 ++++++++++++- lib/src/errors.ts | 1 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/src/access.ts b/lib/src/access.ts index 0b21a7c2..4e342d7b 100644 --- a/lib/src/access.ts +++ b/lib/src/access.ts @@ -1,5 +1,12 @@ import { type AuthProvider } from './auth/auth.js'; -import { NetworkError, PermissionDeniedError, ServiceError, TdfError, UnauthenticatedError } from './errors.js'; +import { + InvalidFileError, + NetworkError, + PermissionDeniedError, + ServiceError, + TdfError, + UnauthenticatedError, +} from './errors.js'; import { pemToCryptoPublicKey, validateSecureUrl } from './utils.js'; export class RewrapRequest { @@ -48,6 +55,10 @@ export async function fetchWrappedKey( if (!response.ok) { switch (response.status) { + case 400: + throw new InvalidFileError( + `400 for [${req.url}]: rewrap failure [${await response.text()}]` + ); case 401: throw new UnauthenticatedError(`401 for [${req.url}]`); case 403: diff --git a/lib/src/errors.ts b/lib/src/errors.ts index e30bd46d..76be014a 100644 --- a/lib/src/errors.ts +++ b/lib/src/errors.ts @@ -31,7 +31,6 @@ export class TdfError extends Error { } } - /** * Errors that indicate the client or method does not have valid options. */