Skip to content

Commit a0e71d5

Browse files
authored
fix(smithy-client): remove support for instanceof operator in ServiceException (#1486)
* fix(smithy-client): remove support for instanceof operator in ServiceException * chore(smithy-client): add changeset
1 parent 1dd6ace commit a0e71d5

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

.changeset/curvy-cups-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/smithy-client": minor
3+
---
4+
5+
fix(smithy-client): remove support for instanceof operator

packages/smithy-client/src/exceptions.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,6 @@ describe("ServiceException type checking", () => {
6969
expect(ServiceException.isInstance({ $metadata: {} })).toBe(false);
7070
});
7171
});
72-
73-
describe("instanceof", () => {
74-
it("should return true for ServiceException instances", () => {
75-
expect(error instanceof ServiceException).toBe(true);
76-
});
77-
78-
it("should return true for duck-typed objects", () => {
79-
expect(duckTyped instanceof ServiceException).toBe(true);
80-
});
81-
82-
it("should return false for invalid objects", () => {
83-
expect({} instanceof ServiceException).toBe(false);
84-
});
85-
});
8672
});
8773

8874
describe("decorateServiceException", () => {

packages/smithy-client/src/exceptions.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ export class ServiceException extends Error implements SmithyException, Metadata
5050
(candidate.$fault === "client" || candidate.$fault === "server")
5151
);
5252
}
53-
54-
public static [Symbol.hasInstance](instance: unknown) {
55-
return ServiceException.isInstance(instance);
56-
}
5753
}
5854

5955
/**

0 commit comments

Comments
 (0)