Moved stringifyError into its own file as it was causing strict compile issues in ErrorHandlingUtils

This commit is contained in:
Chuck Skelton
2026-05-27 18:24:46 -07:00
parent ed7ae08c5b
commit e842196df9
10 changed files with 18 additions and 16 deletions
-1
View File
@@ -15908,7 +15908,6 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
+1 -8
View File
@@ -1,3 +1,4 @@
import { stringifyError } from "Common/stringifyError";
import { MessageTypes } from "../Contracts/ExplorerContracts";
import { SubscriptionType } from "../Contracts/SubscriptionType";
import { isExpectedError } from "../Metrics/ErrorClassification";
@@ -14,14 +15,6 @@ export interface HandleErrorOptions {
redactedError?: string | ARMError | Error;
}
export const stringifyError = (error: unknown): string => {
const plainObject: Record<string, unknown> = {};
Object.getOwnPropertyNames(error as object).forEach((key) => {
plainObject[key] = (error as Record<string, unknown>)[key];
});
return JSON.stringify(plainObject, null, "\r\n");
};
export const handleError = (
error: string | ARMError | Error,
area: string,
+2 -1
View File
@@ -1,3 +1,4 @@
import { stringifyError } from "Common/stringifyError";
import { CosmosDbArtifactType } from "Contracts/FabricMessagesContract";
import { isFabric, isFabricMirroredKey, isFabricNative } from "Platform/Fabric/FabricUtil";
import { AuthType } from "../../AuthType";
@@ -11,7 +12,7 @@ import { listGremlinDatabases } from "../../Utils/arm/generatedClients/cosmos/gr
import { listMongoDBDatabases } from "../../Utils/arm/generatedClients/cosmos/mongoDBResources";
import { listSqlDatabases } from "../../Utils/arm/generatedClients/cosmos/sqlResources";
import { client } from "../CosmosClient";
import { handleError, stringifyError } from "../ErrorHandlingUtils";
import { handleError } from "../ErrorHandlingUtils";
export async function readDatabases(): Promise<DataModels.Database[]> {
let databases: DataModels.Database[];
+7
View File
@@ -0,0 +1,7 @@
export const stringifyError = (error: unknown): string => {
const plainObject: Record<string, unknown> = {};
Object.getOwnPropertyNames(error as object).forEach((key) => {
plainObject[key] = (error as Record<string, unknown>)[key];
});
return JSON.stringify(plainObject, null, "\r\n");
};
+2 -1
View File
@@ -2,6 +2,7 @@ import * as msal from "@azure/msal-browser";
import { Link } from "@fluentui/react/lib/Link";
import { isPublicInternetAccessAllowed } from "Common/DatabaseAccountUtility";
import { sendMessage } from "Common/MessageHandler";
import { stringifyError } from "Common/stringifyError";
import { Platform, configContext } from "ConfigContext";
import { MessageTypes } from "Contracts/ExplorerContracts";
import { useDataPlaneRbac } from "Explorer/Panes/SettingsPane/SettingsPane";
@@ -23,7 +24,7 @@ import { AuthType } from "../AuthType";
import { BindingHandlersRegisterer } from "../Bindings/BindingHandlersRegisterer";
import * as Constants from "../Common/Constants";
import { Areas, ConnectionStatusType, HttpStatusCodes, Notebook } from "../Common/Constants";
import { getErrorMessage, getErrorStack, handleError, stringifyError } from "../Common/ErrorHandlingUtils";
import { getErrorMessage, getErrorStack, handleError } from "../Common/ErrorHandlingUtils";
import * as Logger from "../Common/Logger";
import { QueriesClient } from "../Common/QueriesClient";
import { readCollection } from "../Common/dataAccess/readCollection";
+2 -1
View File
@@ -1,10 +1,11 @@
import { FeedOptions } from "@azure/cosmos";
import { stringifyError } from "Common/stringifyError";
import * as ko from "knockout";
import Q from "q";
import { AuthType } from "../../AuthType";
import * as Constants from "../../Common/Constants";
import { CassandraProxyAPIs } from "../../Common/Constants";
import { handleError, stringifyError } from "../../Common/ErrorHandlingUtils";
import { handleError } from "../../Common/ErrorHandlingUtils";
import * as HeadersUtility from "../../Common/HeadersUtility";
import { createDocument } from "../../Common/dataAccess/createDocument";
import { deleteDocument } from "../../Common/dataAccess/deleteDocument";
+1 -1
View File
@@ -1,6 +1,6 @@
import * as msal from "@azure/msal-browser";
import { getEnvironmentScopeEndpoint } from "Common/EnvironmentUtility";
import { stringifyError } from "Common/ErrorHandlingUtils";
import { stringifyError } from "Common/stringifyError";
import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants";
import { hasProxyServer, isDataplaneRbacSupported } from "Utils/APITypeUtils";
import { AuthType } from "../AuthType";
@@ -6,7 +6,7 @@
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/ErrorHandlingUtils";
import { stringifyError } from "Common/stringifyError";
import { configContext } from "../../../../ConfigContext";
import { armRequest } from "../../request";
import * as Types from "./types";
+1 -1
View File
@@ -5,7 +5,7 @@ Instead, generate ARM clients that consume this function with stricter typing.
*/
import { stringifyError } from "Common/ErrorHandlingUtils";
import { stringifyError } from "Common/stringifyError";
import promiseRetry, { AbortError } from "p-retry";
import { HttpHeaders } from "../../Common/Constants";
import { configContext } from "../../ConfigContext";
+1 -1
View File
@@ -1,6 +1,6 @@
import * as msal from "@azure/msal-browser";
import { useBoolean } from "@fluentui/react-hooks";
import { stringifyError } from "Common/ErrorHandlingUtils";
import { stringifyError } from "Common/stringifyError";
import * as React from "react";
import { ConfigContext } from "../ConfigContext";
import {