From 66ed30f7bd0731501be7e83a90d9c61b450acb5e Mon Sep 17 00:00:00 2001 From: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:44:57 -0700 Subject: [PATCH] instances of error.code were changed to error.name incorrectly --- packages/aws-cdk/lib/api/aws-auth/account-cache.ts | 4 ++-- packages/aws-cdk/test/account-cache.test.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts index 543dbf15d1188..aea859646751f 100644 --- a/packages/aws-cdk/lib/api/aws-auth/account-cache.ts +++ b/packages/aws-cdk/lib/api/aws-auth/account-cache.ts @@ -81,7 +81,7 @@ export class AccountAccessKeyCache { } catch (e: any) { // File doesn't exist or is not readable. This is a cache, // pretend we successfully loaded an empty map. - if (e.name === 'ENOENT' || e.name === 'EACCES') { + if (e.code === 'ENOENT' || e.code === 'EACCES') { return {}; } // File is not JSON, could be corrupted because of concurrent writes. @@ -100,7 +100,7 @@ export class AccountAccessKeyCache { } catch (e: any) { // File doesn't exist or file/dir isn't writable. This is a cache, // if we can't write it then too bad. - if (e.name === 'ENOENT' || e.name === 'EACCES' || e.name === 'EROFS') { + if (e.code === 'ENOENT' || e.code === 'EACCES' || e.code === 'EROFS') { return; } throw e; diff --git a/packages/aws-cdk/test/account-cache.test.ts b/packages/aws-cdk/test/account-cache.test.ts index 0c8334136c6f1..5c338fd42e3e1 100644 --- a/packages/aws-cdk/test/account-cache.test.ts +++ b/packages/aws-cdk/test/account-cache.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable import/order */ import * as path from 'path'; import * as fs from 'fs-extra'; import { withMocked } from './util';