Skip to content

Commit e5ccab7

Browse files
authored
test(codegen): add test case for multiple visible services in model (#1805)
* fix(codegen): aggregation of connected errors * test(codegen): add test case for multiple visible services in model
1 parent 6e7d222 commit e5ccab7

File tree

15 files changed

+166
-2
lines changed

15 files changed

+166
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sync:
88
git fetch --all
99

1010
generate-protocol-tests:
11+
rm -rf ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen
1112
./gradlew :smithy-typescript-protocol-test-codegen:build
1213
rm -rf ./private/smithy-rpcv2-cbor
1314
rm -rf ./private/smithy-rpcv2-cbor-schema

private/my-local-model-schema/src/commands/GetNumbersCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export interface GetNumbersCommandOutput extends GetNumbersResponse, __MetadataB
6868
*
6969
* @throws {@link XYZServiceServiceException} (client fault)
7070
*
71+
* @throws {@link MainServiceLinkedError} (client fault)
72+
*
7173
* @throws {@link XYZServiceSyntheticServiceException}
7274
* <p>Base exception class for all service exceptions from XYZService service.</p>
7375
*

private/my-local-model-schema/src/commands/TradeEventStreamCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export interface TradeEventStreamCommandOutput extends TradeEventStreamResponse,
6868
* @see {@link TradeEventStreamCommandOutput} for command's `response` shape.
6969
* @see {@link XYZServiceClientResolvedConfig | config} for XYZServiceClient's `config` shape.
7070
*
71+
* @throws {@link MainServiceLinkedError} (client fault)
72+
*
7173
* @throws {@link XYZServiceSyntheticServiceException}
7274
* <p>Base exception class for all service exceptions from XYZService service.</p>
7375
*

private/my-local-model-schema/src/models/errors.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ export class HaltError extends __BaseException {
4444
}
4545
}
4646

47+
/**
48+
* @public
49+
*/
50+
export class MainServiceLinkedError extends __BaseException {
51+
readonly name = "MainServiceLinkedError" as const;
52+
readonly $fault = "client" as const;
53+
/**
54+
* @internal
55+
*/
56+
constructor(opts: __ExceptionOptionType<MainServiceLinkedError, __BaseException>) {
57+
super({
58+
name: "MainServiceLinkedError",
59+
$fault: "client",
60+
...opts,
61+
});
62+
Object.setPrototypeOf(this, MainServiceLinkedError.prototype);
63+
}
64+
}
65+
4766
/**
4867
* @public
4968
*/

private/my-local-model-schema/src/schemas/schemas_0.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const _GN = "GetNumbers";
44
const _GNR = "GetNumbersRequest";
55
const _GNRe = "GetNumbersResponse";
66
const _HE = "HaltError";
7+
const _MSLE = "MainServiceLinkedError";
78
const _MTE = "MysteryThrottlingError";
89
const _RE = "RetryableError";
910
const _TE = "TradeEvents";
@@ -35,6 +36,7 @@ import type { StaticErrorSchema, StaticOperationSchema, StaticStructureSchema }
3536
import {
3637
CodedThrottlingError as __CodedThrottlingError,
3738
HaltError as __HaltError,
39+
MainServiceLinkedError as __MainServiceLinkedError,
3840
MysteryThrottlingError as __MysteryThrottlingError,
3941
RetryableError as __RetryableError,
4042
XYZServiceServiceException as __XYZServiceServiceException,
@@ -71,6 +73,12 @@ export var HaltError: StaticErrorSchema = [-3, n0, _HE,
7173
[]
7274
];
7375
TypeRegistry.for(n0).registerError(HaltError, __HaltError);
76+
export var MainServiceLinkedError: StaticErrorSchema = [-3, n0, _MSLE,
77+
{ [_e]: _c, [_hE]: 400 },
78+
[],
79+
[]
80+
];
81+
TypeRegistry.for(n0).registerError(MainServiceLinkedError, __MainServiceLinkedError);
7482
export var MysteryThrottlingError: StaticErrorSchema = [-3, n0, _MTE,
7583
{ [_e]: _c },
7684
[],

private/my-local-model-schema/test/index-objects.spec.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
CodedThrottlingError,
33
GetNumbersCommand,
44
HaltError,
5+
MainServiceLinkedError,
56
MysteryThrottlingError,
67
RetryableError,
78
TradeEventStreamCommand,
@@ -20,6 +21,7 @@ assert(typeof TradeEventStreamCommand === "function");
2021
// errors
2122
assert(CodedThrottlingError.prototype instanceof XYZServiceSyntheticServiceException);
2223
assert(HaltError.prototype instanceof XYZServiceSyntheticServiceException);
24+
assert(MainServiceLinkedError.prototype instanceof XYZServiceSyntheticServiceException);
2325
assert(MysteryThrottlingError.prototype instanceof XYZServiceSyntheticServiceException);
2426
assert(RetryableError.prototype instanceof XYZServiceSyntheticServiceException);
2527
assert(XYZServiceServiceException.prototype instanceof XYZServiceSyntheticServiceException);

private/my-local-model-schema/test/index-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type {
1616
TradeEventStreamResponse,
1717
CodedThrottlingError,
1818
HaltError,
19+
MainServiceLinkedError,
1920
MysteryThrottlingError,
2021
RetryableError,
2122
XYZServiceServiceException,

private/my-local-model/src/commands/GetNumbersCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export interface GetNumbersCommandOutput extends GetNumbersResponse, __MetadataB
6969
*
7070
* @throws {@link XYZServiceServiceException} (client fault)
7171
*
72+
* @throws {@link MainServiceLinkedError} (client fault)
73+
*
7274
* @throws {@link XYZServiceSyntheticServiceException}
7375
* <p>Base exception class for all service exceptions from XYZService service.</p>
7476
*

private/my-local-model/src/commands/TradeEventStreamCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export interface TradeEventStreamCommandOutput extends TradeEventStreamResponse,
7474
* @see {@link TradeEventStreamCommandOutput} for command's `response` shape.
7575
* @see {@link XYZServiceClientResolvedConfig | config} for XYZServiceClient's `config` shape.
7676
*
77+
* @throws {@link MainServiceLinkedError} (client fault)
78+
*
7779
* @throws {@link XYZServiceSyntheticServiceException}
7880
* <p>Base exception class for all service exceptions from XYZService service.</p>
7981
*

private/my-local-model/src/models/errors.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ export class HaltError extends __BaseException {
4444
}
4545
}
4646

47+
/**
48+
* @public
49+
*/
50+
export class MainServiceLinkedError extends __BaseException {
51+
readonly name = "MainServiceLinkedError" as const;
52+
readonly $fault = "client" as const;
53+
/**
54+
* @internal
55+
*/
56+
constructor(opts: __ExceptionOptionType<MainServiceLinkedError, __BaseException>) {
57+
super({
58+
name: "MainServiceLinkedError",
59+
$fault: "client",
60+
...opts,
61+
});
62+
Object.setPrototypeOf(this, MainServiceLinkedError.prototype);
63+
}
64+
}
65+
4766
/**
4867
* @public
4968
*/

0 commit comments

Comments
 (0)