@@ -96,55 +96,37 @@ async function executeStatementAwsRestJson1_1DeserializeError(
96
96
output : HttpResponse
97
97
) : Promise < ExecuteStatementResponse > {
98
98
let data = await parseBody ( output ) ;
99
- if ( output . statusCode === 400 && data . dbConnectionId !== undefined ) {
100
- return Promise . reject ( {
101
- __type : "com.amazon.rdsdataservice#StatementTimeoutException" ,
102
- $name : "StatementTimeoutException" ,
103
- $fault : "client" ,
104
- message : data . message ,
105
- dbConnectionId : data . dbConnectionId
106
- } ) ;
99
+ let response : any ;
100
+ switch ( output . headers [ "x-amzn-ErrorType" ] ) {
101
+ case "BadRequestException" :
102
+ case "com.amazon.rdsdataservice#BadRequestException" :
103
+ response = badRequestExceptionDeserialize ( data ) ;
104
+ break ;
105
+ case "StatementTimeoutException" :
106
+ case "com.amazon.rdsdataservice#StatementTimeoutException" :
107
+ response = statementTimeoutExceptionDeserialize ( data ) ;
108
+ break ;
109
+ case "ForbiddenException" :
110
+ case "com.amazon.rdsdataservice#ForbiddenException" :
111
+ response = forbiddenExceptionDeserialize ( data ) ;
112
+ break ;
113
+ case "InternalServerErrorException" :
114
+ case "com.amazon.rdsdataservice#InternalServerErrorException" :
115
+ response = internalServerErrorExceptionDeserialize ( data ) ;
116
+ break ;
117
+ case "ServiceUnavailableError" :
118
+ case "com.amazon.rdsdataservice#ServiceUnavailableError" :
119
+ response = serviceUnavailableErrorDeserialize ( data ) ;
120
+ break ;
121
+ default :
122
+ response = {
123
+ __type : "com.amazon.rdsdataservice#UnknownException" ,
124
+ $name : "UnknownException" ,
125
+ $fault : "server"
126
+ } ;
107
127
}
108
128
109
- if ( output . statusCode === 400 ) {
110
- return Promise . reject ( {
111
- __type : "com.amazon.rdsdataservice#BadRequestException" ,
112
- $name : "BadRequestException" ,
113
- $fault : "client" ,
114
- message : data . message
115
- } ) ;
116
- }
117
-
118
- if ( output . statusCode === 403 ) {
119
- return Promise . reject ( {
120
- __type : "com.amazon.rdsdataservice#ForbiddenException" ,
121
- $name : "ForbiddenException" ,
122
- $fault : "client" ,
123
- message : data . message
124
- } ) ;
125
- }
126
-
127
- if ( output . statusCode === 500 ) {
128
- return Promise . reject ( {
129
- __type : "com.amazon.rdsdataservice#InternalServerErrorException" ,
130
- $name : "InternalServerErrorException" ,
131
- $fault : "server"
132
- } ) ;
133
- }
134
-
135
- if ( output . statusCode === 503 ) {
136
- return Promise . reject ( {
137
- __type : "com.amazon.rdsdataservice#ServiceUnavailableError" ,
138
- $name : "ServiceUnavailableError" ,
139
- $fault : "server"
140
- } ) ;
141
- }
142
-
143
- return Promise . reject ( {
144
- __type : "com.amazon.rdsdataservice#UnknownException" ,
145
- $name : "UnknownException" ,
146
- $fault : "server"
147
- } ) ;
129
+ return Promise . reject ( response ) ;
148
130
}
149
131
150
132
const sqlParameterListAwsRestJson1_1Serialize = (
@@ -308,6 +290,46 @@ const recordsAwsRestJson1_1Deserialize = (input: any): Array<Array<Field>> =>
308
290
const recordsListAwsRestJson1_1Deserialize = ( input : any ) : Array < Field > =>
309
291
input && input . map ( ( field : any ) => fieldAwsRestJson1_1Deserialize ( field ) ) ;
310
292
293
+ const badRequestExceptionDeserialize = ( input : any ) : BadRequestException => ( {
294
+ __type : "com.amazon.rdsdataservice#BadRequestException" ,
295
+ $name : "BadRequestException" ,
296
+ $fault : "client" ,
297
+ message : input . message
298
+ } ) ;
299
+
300
+ const statementTimeoutExceptionDeserialize = (
301
+ input : any
302
+ ) : StatementTimeoutException => ( {
303
+ __type : "com.amazon.rdsdataservice#StatementTimeoutException" ,
304
+ $name : "StatementTimeoutException" ,
305
+ $fault : "client" ,
306
+ message : input . message ,
307
+ dbConnectionId : input . dbConnectionId
308
+ } ) ;
309
+
310
+ const forbiddenExceptionDeserialize = ( input : any ) : ForbiddenException => ( {
311
+ __type : "com.amazon.rdsdataservice#ForbiddenException" ,
312
+ $name : "ForbiddenException" ,
313
+ $fault : "client" ,
314
+ message : input . message
315
+ } ) ;
316
+
317
+ const internalServerErrorExceptionDeserialize = (
318
+ input : any
319
+ ) : InternalServerErrorException => ( {
320
+ __type : "com.amazon.rdsdataservice#InternalServerErrorException" ,
321
+ $name : "InternalServerErrorException" ,
322
+ $fault : "server"
323
+ } ) ;
324
+
325
+ const serviceUnavailableErrorDeserialize = (
326
+ input : any
327
+ ) : ServiceUnavailableError => ( {
328
+ __type : "com.amazon.rdsdataservice#ServiceUnavailableError" ,
329
+ $name : "ServiceUnavailableError" ,
330
+ $fault : "server"
331
+ } ) ;
332
+
311
333
const deserializeMetadata = ( output : HttpResponse ) : ResponseMetadata => ( {
312
334
httpStatusCode : output . statusCode ,
313
335
httpHeaders : output . headers ,
0 commit comments