diff --git a/src/main.tsx b/src/main.tsx index fa8679e..3e88972 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -15,7 +15,7 @@ import * as Sentry from "@sentry/react"; import { CodexSdk } from "./sdk/codex"; import { ErrorPlaceholder } from "./components/ErrorPlaceholder/ErrorPlaceholder.tsx"; -if (import.meta.env.PROD) { +if (import.meta.env.PROD && !import.meta.env.CI) { Sentry.init({ release: "codex-storage-marketplace-ui@" + import.meta.env.PACKAGE_VERSION, dsn: "https://22d77c59a27b8d5efc07132188b505b9@o4507855852011520.ingest.de.sentry.io/4507866758512720", diff --git a/src/proxy.ts b/src/proxy.ts index a78af36..04a8f54 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -3,7 +3,6 @@ import { CodexData, CodexDataResponse, CodexMarketplace, - CodexReservation, SafeValue, UploadResponse, } from "@codex-storage/sdk-js"; @@ -143,39 +142,39 @@ class CodexMarketplaceMock extends CodexMarketplace { // }, // }); // } - override reservations(): Promise> { - return Promise.resolve({ - error: false, - data: [ - { - id: "0x123456789", - availabilityId: "0x12345678910", - requestId: "0x1234567891011", - /** - * Size in bytes - */ - size: 500_000_000 + "", - /** - * Slot Index as hexadecimal string - */ - slotIndex: "2", - }, - { - id: "0x987654321", - availabilityId: "0x9876543210", - requestId: "0x98765432100", - /** - * Size in bytes - */ - size: 500_000_000 + "", - /** - * Slot Index as hexadecimal string - */ - slotIndex: "1", - }, - ], - }); - } + // override reservations(): Promise> { + // return Promise.resolve({ + // error: false, + // data: [ + // { + // id: "0x123456789", + // availabilityId: "0x12345678910", + // requestId: "0x1234567891011", + // /** + // * Size in bytes + // */ + // size: 500_000_000 + "", + // /** + // * Slot Index as hexadecimal string + // */ + // slotIndex: "2", + // }, + // { + // id: "0x987654321", + // availabilityId: "0x9876543210", + // requestId: "0x98765432100", + // /** + // * Size in bytes + // */ + // size: 500_000_000 + "", + // /** + // * Slot Index as hexadecimal string + // */ + // slotIndex: "1", + // }, + // ], + // }); + // } } export const CodexSdk = { diff --git a/src/utils/errors.ts b/src/utils/errors.ts index d9830fc..90a085a 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -1,32 +1,18 @@ import * as Sentry from "@sentry/browser"; -import { isCodexOnline } from "../components/NodeIndicator/NodeIndicator"; import { CodexError } from "@codex-storage/sdk-js"; -// It would be preferable to completely ignore the error -// when the node is not connected. However, during the -// initial load, we lack this information until the -// SPR response is completed. In the meantime, other -// requests may be initiated, so if the node is not -// connected, we should set the level to 'log'. -const getLogLevel = () => { - switch (isCodexOnline) { - case true: - return "error"; - case null: - return "info"; - case false: - return "log"; - } -}; - export const Errors = { report(safe: { error: true, data: CodexError }) { + if (safe.data.code === 502) { + // Ignore Gateway error + return + } + Sentry.captureException(safe.data, { extra: { code: safe.data.code, errors: safe.data.errors, sourceStack: safe.data.sourceStack, - level: getLogLevel(), }, }); } diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index ca737c8..bb5e7a0 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -2,6 +2,7 @@ interface ImportMetaEnv { VITE_CODEX_API_URL: string; + VITE_GEO_IP_URL: string; } interface ImportMeta {