Skip to content

Commit

Permalink
fix(smithy-client): remove support for instanceof operator in Service…
Browse files Browse the repository at this point in the history
…Exception (#1486)

* fix(smithy-client): remove support for instanceof operator in ServiceException

* chore(smithy-client): add changeset
  • Loading branch information
siddsriv authored Jan 2, 2025
1 parent 1dd6ace commit a0e71d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-cups-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/smithy-client": minor
---

fix(smithy-client): remove support for instanceof operator
14 changes: 0 additions & 14 deletions packages/smithy-client/src/exceptions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
4 changes: 0 additions & 4 deletions packages/smithy-client/src/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit a0e71d5

Please # to comment.