MISC: Improve exception alert (#1709)

This commit is contained in:
catloversg
2024-10-22 10:36:29 +07:00
committed by GitHub
parent 8d1cfb2d97
commit bc51733fbe
10 changed files with 47 additions and 59 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
import React from "react";
import { Page } from "../ui/Router";
import { hash } from "../hash/hash";
import type { Page } from "../ui/Router";
import { commitHash } from "./helpers/commitHash";
import { CONSTANTS } from "../Constants";
enum GameEnv {
@@ -16,7 +16,7 @@ enum Platform {
interface GameVersion {
version: string;
hash: string;
commitHash: string;
toDisplay: () => string;
}
@@ -54,13 +54,13 @@ export interface IErrorData {
export const newIssueUrl = `https://github.com/bitburner-official/bitburner-src/issues/new`;
function getErrorMetadata(error: unknown, errorInfo?: React.ErrorInfo, page?: Page): IErrorMetadata {
export function getErrorMetadata(error: unknown, errorInfo?: React.ErrorInfo, page?: Page): IErrorMetadata {
const isElectron = navigator.userAgent.toLowerCase().includes(" electron/");
const env = process.env.NODE_ENV === "development" ? GameEnv.Development : GameEnv.Production;
const version: GameVersion = {
version: CONSTANTS.VersionString,
hash: hash(),
toDisplay: () => `v${CONSTANTS.VersionString} (${hash()})`,
commitHash: commitHash(),
toDisplay: () => `v${CONSTANTS.VersionString} (${commitHash()})`,
};
const features: BrowserFeatures = {
userAgent: navigator.userAgent,