Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored May 27, 2024
1 parent dccb86c commit 4e111f4
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
};

const stopWatch = new StopWatch();
let context: IRequestContext | undefined, error: ExtensionGalleryError | undefined, total: number = 0;
let context: IRequestContext | undefined, errorCode: ExtensionGalleryErrorCode | undefined, total: number = 0;

try {
context = await this.requestService.request({
Expand Down Expand Up @@ -989,9 +989,14 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
return { galleryExtensions: [], total };

} catch (e) {
const errorCode = isCancellationError(e) ? ExtensionGalleryErrorCode.Cancelled : getErrorMessage(e).startsWith('XHR timeout') ? ExtensionGalleryErrorCode.Timeout : ExtensionGalleryErrorCode.Failed;
error = new ExtensionGalleryError(getErrorMessage(e), errorCode);
throw error;
if (isCancellationError(e)) {
errorCode = ExtensionGalleryErrorCode.Cancelled;
throw e;
} else {
const errorMessage = getErrorMessage(e);
errorCode = errorMessage.startsWith('XHR timeout') ? ExtensionGalleryErrorCode.Timeout : ExtensionGalleryErrorCode.Failed;
throw new ExtensionGalleryError(errorMessage, errorCode);
}
} finally {
this.telemetryService.publicLog2<GalleryServiceQueryEvent, GalleryServiceQueryClassification>('galleryService:query', {
...query.telemetryData,
Expand All @@ -1000,7 +1005,7 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
success: !!context && isSuccess(context),
responseBodySize: context?.res.headers['Content-Length'],
statusCode: context ? String(context.res.statusCode) : undefined,
errorCode: error?.code,
errorCode,
count: String(total)
});
}
Expand Down

0 comments on commit 4e111f4

Please sign in to comment.