Skip to content

Commit 2aa69b8

Browse files
committed
feat(clients): generate exceptions as classes
1 parent 5922056 commit 2aa69b8

File tree

928 files changed

+168494
-449022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

928 files changed

+168494
-449022
lines changed

clients/client-accessanalyzer/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export * from "./AccessAnalyzer";
22
export * from "./AccessAnalyzerClient";
33
export * from "./commands";
44
export * from "./models";
5+
export { SdkException } from "@aws-sdk/smithy-client";
56
export * from "./pagination";

clients/client-accessanalyzer/src/models/models_0.ts

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
1-
import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "@aws-sdk/types";
1+
import { SdkException as __SdkException } from "@aws-sdk/smithy-client";
2+
import { MetadataBearer as $MetadataBearer, ResponseMetadata as __ResponseMetadata } from "@aws-sdk/types";
23

34
/**
45
* <p>You do not have sufficient access to perform this action.</p>
56
*/
6-
export interface AccessDeniedException extends __SmithyException, $MetadataBearer {
7+
export interface AccessDeniedException extends __SdkException {
78
name: "AccessDeniedException";
89
$fault: "client";
9-
message: string | undefined;
10+
}
11+
12+
export class AccessDeniedException extends __SdkException {
13+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
14+
super({
15+
name: "AccessDeniedException",
16+
$fault: "client",
17+
$metadata: responseMetadata,
18+
});
19+
Object.setPrototypeOf(this, AccessDeniedException.prototype);
20+
Object.assign(this, { ...deserialized });
21+
}
1022
}
1123

1224
/**
1325
* <p>A conflict exception error.</p>
1426
*/
15-
export interface ConflictException extends __SmithyException, $MetadataBearer {
27+
export interface ConflictException extends __SdkException {
1628
name: "ConflictException";
1729
$fault: "client";
18-
message: string | undefined;
1930
/**
2031
* <p>The ID of the resource.</p>
2132
*/
@@ -27,6 +38,18 @@ export interface ConflictException extends __SmithyException, $MetadataBearer {
2738
resourceType: string | undefined;
2839
}
2940

41+
export class ConflictException extends __SdkException {
42+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
43+
super({
44+
name: "ConflictException",
45+
$fault: "client",
46+
$metadata: responseMetadata,
47+
});
48+
Object.setPrototypeOf(this, ConflictException.prototype);
49+
Object.assign(this, { ...deserialized });
50+
}
51+
}
52+
3053
/**
3154
* <p>The criteria to use in the filter that defines the archive rule.</p>
3255
*/
@@ -98,24 +121,34 @@ export namespace CreateArchiveRuleRequest {
98121
/**
99122
* <p>Internal server error.</p>
100123
*/
101-
export interface InternalServerException extends __SmithyException, $MetadataBearer {
124+
export interface InternalServerException extends __SdkException {
102125
name: "InternalServerException";
103126
$fault: "server";
104127
$retryable: {};
105-
message: string | undefined;
106128
/**
107129
* <p>The seconds to wait to retry.</p>
108130
*/
109131
retryAfterSeconds?: number;
110132
}
111133

134+
export class InternalServerException extends __SdkException {
135+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
136+
super({
137+
name: "InternalServerException",
138+
$fault: "server",
139+
$metadata: responseMetadata,
140+
});
141+
Object.setPrototypeOf(this, InternalServerException.prototype);
142+
Object.assign(this, { ...deserialized });
143+
}
144+
}
145+
112146
/**
113147
* <p>The specified resource could not be found.</p>
114148
*/
115-
export interface ResourceNotFoundException extends __SmithyException, $MetadataBearer {
149+
export interface ResourceNotFoundException extends __SdkException {
116150
name: "ResourceNotFoundException";
117151
$fault: "client";
118-
message: string | undefined;
119152
/**
120153
* <p>The ID of the resource.</p>
121154
*/
@@ -127,13 +160,24 @@ export interface ResourceNotFoundException extends __SmithyException, $MetadataB
127160
resourceType: string | undefined;
128161
}
129162

163+
export class ResourceNotFoundException extends __SdkException {
164+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
165+
super({
166+
name: "ResourceNotFoundException",
167+
$fault: "client",
168+
$metadata: responseMetadata,
169+
});
170+
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
171+
Object.assign(this, { ...deserialized });
172+
}
173+
}
174+
130175
/**
131176
* <p>Service quote met error.</p>
132177
*/
133-
export interface ServiceQuotaExceededException extends __SmithyException, $MetadataBearer {
178+
export interface ServiceQuotaExceededException extends __SdkException {
134179
name: "ServiceQuotaExceededException";
135180
$fault: "client";
136-
message: string | undefined;
137181
/**
138182
* <p>The resource ID.</p>
139183
*/
@@ -145,22 +189,45 @@ export interface ServiceQuotaExceededException extends __SmithyException, $Metad
145189
resourceType: string | undefined;
146190
}
147191

192+
export class ServiceQuotaExceededException extends __SdkException {
193+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
194+
super({
195+
name: "ServiceQuotaExceededException",
196+
$fault: "client",
197+
$metadata: responseMetadata,
198+
});
199+
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
200+
Object.assign(this, { ...deserialized });
201+
}
202+
}
203+
148204
/**
149205
* <p>Throttling limit exceeded error.</p>
150206
*/
151-
export interface ThrottlingException extends __SmithyException, $MetadataBearer {
207+
export interface ThrottlingException extends __SdkException {
152208
name: "ThrottlingException";
153209
$fault: "client";
154210
$retryable: {
155211
throttling: true;
156212
};
157-
message: string | undefined;
158213
/**
159214
* <p>The seconds to wait to retry.</p>
160215
*/
161216
retryAfterSeconds?: number;
162217
}
163218

219+
export class ThrottlingException extends __SdkException {
220+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
221+
super({
222+
name: "ThrottlingException",
223+
$fault: "client",
224+
$metadata: responseMetadata,
225+
});
226+
Object.setPrototypeOf(this, ThrottlingException.prototype);
227+
Object.assign(this, { ...deserialized });
228+
}
229+
}
230+
164231
/**
165232
* <p>Contains information about a validation exception.</p>
166233
*/
@@ -195,10 +262,9 @@ export enum ValidationExceptionReason {
195262
/**
196263
* <p>Validation exception error.</p>
197264
*/
198-
export interface ValidationException extends __SmithyException, $MetadataBearer {
265+
export interface ValidationException extends __SdkException {
199266
name: "ValidationException";
200267
$fault: "client";
201-
message: string | undefined;
202268
/**
203269
* <p>The reason for the exception.</p>
204270
*/
@@ -210,6 +276,18 @@ export interface ValidationException extends __SmithyException, $MetadataBearer
210276
fieldList?: ValidationExceptionField[];
211277
}
212278

279+
export class ValidationException extends __SdkException {
280+
constructor(responseMetadata: __ResponseMetadata, deserialized: any) {
281+
super({
282+
name: "ValidationException",
283+
$fault: "client",
284+
$metadata: responseMetadata,
285+
});
286+
Object.setPrototypeOf(this, ValidationException.prototype);
287+
Object.assign(this, { ...deserialized });
288+
}
289+
}
290+
213291
/**
214292
* <p>Deletes an archive rule.</p>
215293
*/

0 commit comments

Comments
 (0)