mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-29 01:27:22 +01:00
Removing temporary debug logging (#2509)
* Adding further console logging but also fixed lines with JSON.stringify(error) * Added retry mechanism for GETs for armRequest workflow * Moved stringifyError into its own file as it was causing strict compile issues in ErrorHandlingUtils * Removing temporary debug logging * Undoing eslint change as well
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
Generated from: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB/preview/2025-11-01-preview/cosmos-db.json
|
||||
*/
|
||||
|
||||
import { stringifyError } from "Common/stringifyError";
|
||||
import { configContext } from "../../../../ConfigContext";
|
||||
import { armRequest } from "../../request";
|
||||
import * as Types from "./types";
|
||||
@@ -19,14 +18,7 @@ export async function listSqlDatabases(
|
||||
accountName: string,
|
||||
): Promise<Types.SqlDatabaseListResult> {
|
||||
const path = `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}/sqlDatabases`;
|
||||
console.log("{{cdbp}} in listSqlDatabases(): path: " + path);
|
||||
try {
|
||||
console.log("{{cdbp}} in listSqlDatabases(): calling armRequest");
|
||||
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
|
||||
} catch (error) {
|
||||
console.log("{{cdbp}} in listSqlDatabases(): ERROR: " + stringifyError(error));
|
||||
throw error;
|
||||
}
|
||||
return armRequest({ host: configContext.ARM_ENDPOINT, path, method: "GET", apiVersion });
|
||||
}
|
||||
|
||||
/* Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. */
|
||||
|
||||
@@ -5,7 +5,6 @@ Instead, generate ARM clients that consume this function with stricter typing.
|
||||
|
||||
*/
|
||||
|
||||
import { stringifyError } from "Common/stringifyError";
|
||||
import promiseRetry, { AbortError } from "p-retry";
|
||||
import { HttpHeaders } from "../../Common/Constants";
|
||||
import { configContext } from "../../ConfigContext";
|
||||
@@ -78,9 +77,6 @@ export async function armRequestWithoutPolling<T>({
|
||||
}
|
||||
|
||||
if (!userContext?.authorizationToken && !customHeaders?.["Authorization"]) {
|
||||
console.log(
|
||||
"{{cdbp}} in armRequestWithoutPolling(): condition '!userContext?.authorizationToken && !customHeaders?.['Authorization']' met, throwing 'No authority token provided' error",
|
||||
);
|
||||
throw new Error("No authority token provided");
|
||||
}
|
||||
|
||||
@@ -98,9 +94,6 @@ export async function armRequestWithoutPolling<T>({
|
||||
};
|
||||
|
||||
const effectiveTimeoutMs = timeoutMs ?? DEFAULT_ARM_TIMEOUT_MS;
|
||||
console.log(
|
||||
`{{cdbp}} in armRequestWithoutPolling(): calling fetchWithRetry (method=${method}, timeoutMs=${effectiveTimeoutMs}, hasSignal=${!!signal})`,
|
||||
);
|
||||
const response = await fetchWithRetry(url.href, fetchInit, method, effectiveTimeoutMs, signal);
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -115,11 +108,9 @@ export async function armRequestWithoutPolling<T>({
|
||||
error.code = errorResponse.code;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("{{cdbp}} in armRequestWithoutPolling(): ERROR: " + stringifyError(error));
|
||||
throw new Error(await response.text());
|
||||
}
|
||||
|
||||
console.log("{{cdbp}} in armRequestWithoutPolling(): ERROR: " + stringifyError(error));
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -184,7 +175,6 @@ async function fetchWithRetry(
|
||||
(attemptNumber: number) => {
|
||||
const attemptTimeoutMs =
|
||||
timeoutMs * RETRY_TIMEOUT_MULTIPLIERS[Math.min(attemptNumber - 1, RETRY_TIMEOUT_MULTIPLIERS.length - 1)];
|
||||
console.log(`{{cdbp}} in fetchWithRetry(): calling fetchWithTimeout: attempt=${attemptNumber} url=${url}`);
|
||||
return fetchWithTimeout(url, fetchInit, attemptTimeoutMs);
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user