mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-04-20 05:19:28 +01:00
Fix extractHeaderStatus to handle undefined and non-string messages (#2393)
* Fix extractHeaderStatus to handle undefined and non-string messages * Fix unsafe casts --------- Co-authored-by: Laurent Nguyen <languye@microsoft.com>
This commit is contained in:
@@ -113,7 +113,7 @@ export class ContainerSampleGenerator {
|
|||||||
? await createMongoDocument(collection.databaseId, collection, shardKey, doc)
|
? await createMongoDocument(collection.databaseId, collection, shardKey, doc)
|
||||||
: await createDocument(collection, doc);
|
: await createDocument(collection, doc);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
NotificationConsoleUtils.logConsoleError(error);
|
NotificationConsoleUtils.logConsoleError(error instanceof Error ? error.message : String(error));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -329,7 +329,10 @@ export class NotificationConsoleComponent extends React.Component<
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static extractHeaderStatus(consoleData: ConsoleData) {
|
private static extractHeaderStatus(consoleData: ConsoleData) {
|
||||||
return consoleData?.message.split(":\n")[0];
|
if (!consoleData?.message || typeof consoleData.message !== "string") {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return consoleData.message.split(":\n")[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private onConsoleWasExpanded = (): void => {
|
private onConsoleWasExpanded = (): void => {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ const requestFabricToken = async (): Promise<void> => {
|
|||||||
|
|
||||||
scheduleRefreshFabricToken();
|
scheduleRefreshFabricToken();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logConsoleError(error as string);
|
logConsoleError(error instanceof Error ? error.message : String(error));
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
lastRequestTimestamp = undefined;
|
lastRequestTimestamp = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user