Change error handling to use only the message rather than casting to any.

This commit is contained in:
Craig Boger (from Dev Box) 2025-02-06 17:07:57 -08:00
parent abaa5a0743
commit c654ecb92c
2 changed files with 2 additions and 7 deletions

View File

@ -243,16 +243,13 @@ export function client(): Cosmos.CosmosClient {
const options: Cosmos.CosmosClientOptions = {
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
// endpoint: "https://test-craig-nosql-westus3.documents.azure.com:443/",
// endpoint: "https://test-craig-nosql-eastus2.documents.azure.com:443/",
key: userContext.dataPlaneRbacEnabled ? "" : userContext.masterKey,
tokenProvider,
userAgentSuffix: "Azure Portal",
defaultHeaders: _defaultHeaders,
connectionPolicy: {
retryOptions: {
//maxRetryAttemptCount: LocalStorageUtility.getEntryNumber(StorageKey.RetryAttempts),
maxRetryAttemptCount: 0,
maxRetryAttemptCount: LocalStorageUtility.getEntryNumber(StorageKey.RetryAttempts),
fixedRetryIntervalInMilliseconds: LocalStorageUtility.getEntryNumber(StorageKey.RetryInterval),
maxWaitTimeInSeconds: LocalStorageUtility.getEntryNumber(StorageKey.MaxWaitTimeInSeconds),
},

View File

@ -9,9 +9,7 @@ import { sendMessage } from "./MessageHandler";
export const handleError = (error: string | ARMError | Error, area: string, consoleErrorPrefix?: string): void => {
const errorMessage = getErrorMessage(error);
const anyError = error as any;
const errorCode: string | number | undefined =
error instanceof ARMError ? error.code : anyError?.code ? anyError.code : undefined;
const errorCode = error instanceof ARMError ? error.code : undefined;
// logs error to data explorer console
const consoleErrorMessage = consoleErrorPrefix ? `${consoleErrorPrefix}:\n ${errorMessage}` : errorMessage;