mirror of
https://github.com/logos-storage/logos-storage-marketplace-ui.git
synced 2026-04-18 17:03:10 +00:00
Fix report issue
This commit is contained in:
parent
57887a5577
commit
bc70ff1397
@ -1,4 +1,4 @@
|
||||
import { CodexError, SafeValue } from "@codex-storage/sdk-js";
|
||||
import { SafeValue } from "@codex-storage/sdk-js";
|
||||
import * as Sentry from "@sentry/browser";
|
||||
import { isCodexOnline } from "../components/NodeIndicator/NodeIndicator";
|
||||
|
||||
@ -21,15 +21,18 @@ const getLogLevel = () => {
|
||||
|
||||
export const Promises = {
|
||||
rejectOnError: <T>(safe: SafeValue<T>, report = true) => {
|
||||
if (safe.error && report) {
|
||||
Sentry.captureException(safe.data, {
|
||||
extra: {
|
||||
code: safe.data.code,
|
||||
errors: safe.data.errors,
|
||||
sourceStack: safe.data.sourceStack,
|
||||
level: getLogLevel(),
|
||||
},
|
||||
});
|
||||
if (safe.error) {
|
||||
if (report) {
|
||||
Sentry.captureException(safe.data, {
|
||||
extra: {
|
||||
code: safe.data.code,
|
||||
errors: safe.data.errors,
|
||||
sourceStack: safe.data.sourceStack,
|
||||
level: getLogLevel(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.reject(safe.data);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user