From 040ff5a8cc56644eaf3b7b8ccd11168975a11af7 Mon Sep 17 00:00:00 2001 From: siddsriv Date: Thu, 2 Jan 2025 22:14:15 +0000 Subject: [PATCH 1/2] fix(smithy-client): remove support for instanceof operator in ServiceException --- packages/smithy-client/src/exceptions.spec.ts | 14 -------------- packages/smithy-client/src/exceptions.ts | 4 ---- 2 files changed, 18 deletions(-) diff --git a/packages/smithy-client/src/exceptions.spec.ts b/packages/smithy-client/src/exceptions.spec.ts index fc591f96a3e..5aecb9553db 100644 --- a/packages/smithy-client/src/exceptions.spec.ts +++ b/packages/smithy-client/src/exceptions.spec.ts @@ -69,20 +69,6 @@ describe("ServiceException type checking", () => { expect(ServiceException.isInstance({ $metadata: {} })).toBe(false); }); }); - - describe("instanceof", () => { - it("should return true for ServiceException instances", () => { - expect(error instanceof ServiceException).toBe(true); - }); - - it("should return true for duck-typed objects", () => { - expect(duckTyped instanceof ServiceException).toBe(true); - }); - - it("should return false for invalid objects", () => { - expect({} instanceof ServiceException).toBe(false); - }); - }); }); describe("decorateServiceException", () => { diff --git a/packages/smithy-client/src/exceptions.ts b/packages/smithy-client/src/exceptions.ts index 298fd40a65a..922c230f229 100644 --- a/packages/smithy-client/src/exceptions.ts +++ b/packages/smithy-client/src/exceptions.ts @@ -50,10 +50,6 @@ export class ServiceException extends Error implements SmithyException, Metadata (candidate.$fault === "client" || candidate.$fault === "server") ); } - - public static [Symbol.hasInstance](instance: unknown) { - return ServiceException.isInstance(instance); - } } /** From 7dc073c1d1618df8132df61b355d79ffbca391e6 Mon Sep 17 00:00:00 2001 From: siddsriv Date: Thu, 2 Jan 2025 22:16:12 +0000 Subject: [PATCH 2/2] chore(smithy-client): add changeset --- .changeset/curvy-cups-fly.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/curvy-cups-fly.md diff --git a/.changeset/curvy-cups-fly.md b/.changeset/curvy-cups-fly.md new file mode 100644 index 00000000000..5e934c90817 --- /dev/null +++ b/.changeset/curvy-cups-fly.md @@ -0,0 +1,5 @@ +--- +"@smithy/smithy-client": minor +--- + +fix(smithy-client): remove support for instanceof operator