Skip to content

Commit ebf18ff

Browse files
committed
fix(codegen): aggregation of connected errors
1 parent bbdb091 commit ebf18ff

File tree

12 files changed

+126
-0
lines changed

12 files changed

+126
-0
lines changed

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
*/

private/my-local-model/src/protocols/Rpcv2cbor.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { TradeEventStreamCommandInput, TradeEventStreamCommandOutput } from "../
3535
import {
3636
CodedThrottlingError,
3737
HaltError,
38+
MainServiceLinkedError,
3839
MysteryThrottlingError,
3940
RetryableError,
4041
XYZServiceServiceException,
@@ -133,6 +134,9 @@ const de_CommandError = async (
133134
case "HaltError":
134135
case "org.xyz.v1#HaltError":
135136
throw await de_HaltErrorRes(parsedOutput, context);
137+
case "MainServiceLinkedError":
138+
case "org.xyz.v1#MainServiceLinkedError":
139+
throw await de_MainServiceLinkedErrorRes(parsedOutput, context);
136140
case "MysteryThrottlingError":
137141
case "org.xyz.v1#MysteryThrottlingError":
138142
throw await de_MysteryThrottlingErrorRes(parsedOutput, context);
@@ -184,6 +188,22 @@ const de_HaltErrorRes = async (
184188
return __decorateServiceException(exception, body);
185189
};
186190

191+
/**
192+
* deserializeRpcv2cborMainServiceLinkedErrorRes
193+
*/
194+
const de_MainServiceLinkedErrorRes = async (
195+
parsedOutput: any,
196+
context: __SerdeContext
197+
): Promise<MainServiceLinkedError> => {
198+
const body = parsedOutput.body
199+
const deserialized: any = _json(body);
200+
const exception = new MainServiceLinkedError({
201+
$metadata: deserializeMetadata(parsedOutput),
202+
...deserialized
203+
});
204+
return __decorateServiceException(exception, body);
205+
};
206+
187207
/**
188208
* deserializeRpcv2cborMysteryThrottlingErrorRes
189209
*/
@@ -382,6 +402,8 @@ const se_Alpha_event = (
382402

383403
// de_HaltError omitted.
384404

405+
// de_MainServiceLinkedError omitted.
406+
385407
// de_MysteryThrottlingError omitted.
386408

387409
// de_RetryableError omitted.

0 commit comments

Comments
 (0)