File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
packages/smithy-client/src Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
- import { decorateServiceException , ServiceException } from "./exceptions" ;
1
+ import { decorateServiceException , ExceptionOptionType , ServiceException } from "./exceptions" ;
2
2
3
3
it ( "ServiceException extends from Error" , ( ) => {
4
4
expect (
@@ -11,6 +11,23 @@ it("ServiceException extends from Error", () => {
11
11
) . toBeInstanceOf ( Error ) ;
12
12
} ) ;
13
13
14
+ it ( "ExceptionOptionType allows specifying message" , ( ) => {
15
+ class SomeException extends ServiceException {
16
+ constructor ( opts : ExceptionOptionType < SomeException , ServiceException > ) {
17
+ super ( {
18
+ name : "SomeException" ,
19
+ $fault : "client" ,
20
+ ...opts ,
21
+ } ) ;
22
+ }
23
+ }
24
+ const exception = new SomeException ( {
25
+ message : "message" ,
26
+ $metadata : { } ,
27
+ } ) ;
28
+ expect ( exception . message ) . toBe ( "message" ) ;
29
+ } ) ;
30
+
14
31
describe ( "decorateServiceException" , ( ) => {
15
32
const exception = new ServiceException ( {
16
33
name : "Error" ,
You can’t perform that action at this time.
0 commit comments