File tree Expand file tree Collapse file tree 6 files changed +27
-14
lines changed Expand file tree Collapse file tree 6 files changed +27
-14
lines changed Original file line number Diff line number Diff line change @@ -531,7 +531,7 @@ export const Constants: {
531531 Location: string ;
532532 Referer: string ;
533533 A_IM: string ;
534- PREFER_RETURN_MINIMAL : string ;
534+ PreferReturnMinimal : string ;
535535 Query: string ;
536536 IsQuery: string ;
537537 IsQueryPlan: string ;
@@ -1136,25 +1136,17 @@ export interface ErrorBody {
11361136 message: string ;
11371137}
11381138
1139- // @public (undocumented)
1139+ // @public
11401140export class ErrorResponse extends Error {
1141- // (undocumented)
11421141 [key : string ]: any ;
1143- // (undocumented)
11441142 activityId? : string ;
1145- // (undocumented)
11461143 body? : ErrorBody ;
1147- // (undocumented)
11481144 code? : number | string ;
1149- // (undocumented)
11501145 diagnostics? : CosmosDiagnostics ;
1151- // (undocumented)
11521146 headers? : CosmosHeaders ;
1153- // (undocumented)
1147+ requestCharge ? : number ;
11541148 retryAfterInMilliseconds? : number ;
1155- // (undocumented)
11561149 retryAfterInMs? : number ;
1157- // (undocumented)
11581150 substatus? : number ;
11591151}
11601152
Original file line number Diff line number Diff line change @@ -116,10 +116,12 @@ export class BulkResponse {
116116 const error : ErrorResponse = new ErrorResponse ( ) ;
117117 error . code = itemResponse ?. statusCode ;
118118 error . substatus = itemResponse ?. subStatusCode ;
119+ error . message = itemResponse ?. message ;
120+ error . requestCharge = itemResponse ?. requestCharge ;
119121 error . body = itemResponse ?. resourceBody ;
120122 error . headers = responseMessage . headers ;
121123 error . activityId = responseMessage . headers ?. [ Constants . HttpHeaders . ActivityId ] ;
122- error . retryAfterInMs = itemResponse ?. retryAfter ;
124+ error . retryAfterInMs = itemResponse ?. retryAfterMilliseconds ;
123125 error . diagnostics = responseMessage . diagnostics ;
124126 results . push ( error ) ;
125127 }
@@ -167,6 +169,7 @@ export class BulkResponse {
167169 errorResponse . body = error . body ;
168170 errorResponse . diagnostics = error . diagnostics ;
169171 errorResponse . headers = this . headers ;
172+ errorResponse . requestCharge = error . requestCharge ;
170173 return errorResponse ;
171174 } ) ;
172175 }
Original file line number Diff line number Diff line change @@ -148,6 +148,9 @@ export class LimiterQueue {
148148 this . terminated = true ;
149149 this . terminatedValue = customValue ;
150150 const operationsList : ItemOperation [ ] = [ ] ;
151+ if ( this . tasks . isEmpty ( ) ) {
152+ return ;
153+ }
151154 while ( ! this . tasks . isEmpty ( ) ) {
152155 const queueItem = this . tasks . shift ( ) ;
153156 if ( ! queueItem ) break ;
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export const Constants = {
6161 Location : "Location" ,
6262 Referer : "referer" ,
6363 A_IM : "A-IM" ,
64- PREFER_RETURN_MINIMAL : "return=minimal" ,
64+ PreferReturnMinimal : "return=minimal" ,
6565
6666 // Query
6767 Query : "x-ms-documentdb-query" ,
Original file line number Diff line number Diff line change @@ -94,14 +94,29 @@ export interface GroupByAliasToAggregateType {
9494 [ key : string ] : AggregateType ;
9595}
9696
97+ /**
98+ * Represents an error response returned in operations.
99+ */
97100export class ErrorResponse extends Error {
101+ /** status or error code returned */
98102 code ?: number | string ;
103+ /** substatus code returned */
99104 substatus ?: number ;
105+ /** body of the error response, typically including error details */
100106 body ?: ErrorBody ;
107+ /** HTTP headers */
101108 headers ?: CosmosHeaders ;
109+ /** unique identifier for the operation's activity */
102110 activityId ?: string ;
111+ /** delay (in milliseconds) before retrying the operation. */
103112 retryAfterInMs ?: number ;
113+ /** delay (in milliseconds) before retrying the operation. */
114+ /** Note: Use retryAfterInMs instead */
104115 retryAfterInMilliseconds ?: number ;
116+ /** any additional property */
105117 [ key : string ] : any ;
118+ /** Detailed diagnostic information associated with the error.*/
106119 diagnostics ?: CosmosDiagnostics ;
120+ /** The request charge of the operation, representing the resource cost incurred.*/
121+ requestCharge ?: number ;
107122}
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ export async function getHeaders({
260260 ! options . contentResponseOnWriteEnabled
261261 ) {
262262 if ( operationType === OperationType . Batch ) {
263- headers [ Constants . HttpHeaders . Prefer ] = Constants . HttpHeaders . PREFER_RETURN_MINIMAL ;
263+ headers [ Constants . HttpHeaders . Prefer ] = Constants . HttpHeaders . PreferReturnMinimal ;
264264 } else {
265265 throw new ErrorResponse (
266266 "Currently `contentResponseOnWriteEnabled` option is only supported for batch and bulk operations." ,
You can’t perform that action at this time.
0 commit comments