From d752465e7a60575b704b7219822fde75765f588e Mon Sep 17 00:00:00 2001 From: "Ng Wing Tat, David" Date: Thu, 10 Dec 2020 11:16:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Capture=20log=20for=200=20gas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/tx-store/tx-store.ts | 3 ++- app/utils/error.ts | 11 ++++++++++- app/utils/sentry.ts | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/models/tx-store/tx-store.ts b/app/models/tx-store/tx-store.ts index 381a7b6fe..e376951a8 100644 --- a/app/models/tx-store/tx-store.ts +++ b/app/models/tx-store/tx-store.ts @@ -14,7 +14,7 @@ import { CosmosTxQueryResult, } from "../../services/cosmos" import { parseCosmosCoin } from "../../services/cosmos/cosmos.utils" -import { logError } from "../../utils/error" +import { logError, logMessage } from "../../utils/error" import { translateWithFallbackText } from "../../i18n" @@ -128,6 +128,7 @@ export const TxStoreModel = types let estimatedGas: number = yield message.simulate({ memo: self.memo }) if (estimatedGas === 0) { estimatedGas = 200000 + logMessage('[TxStore] Estimated gas is 0') } self.gas = new BigNumber(estimatedGas) } catch (error) { diff --git a/app/utils/error.ts b/app/utils/error.ts index 6a2a63ef1..f5f3df6ed 100644 --- a/app/utils/error.ts +++ b/app/utils/error.ts @@ -1,4 +1,4 @@ -import { sentryCaptureError } from './sentry' +import { sentryCaptureError, sentryCaptureMessage } from './sentry' export function logError(err: any) { if (__DEV__) { @@ -8,3 +8,12 @@ export function logError(err: any) { sentryCaptureError(err) } } + +export function logMessage(msg: string) { + if (__DEV__) { + console.tron.warn(msg) + } else { + console.warn(msg) + sentryCaptureMessage(msg) + } +} diff --git a/app/utils/sentry.ts b/app/utils/sentry.ts index 937feb542..bbba3793d 100644 --- a/app/utils/sentry.ts +++ b/app/utils/sentry.ts @@ -9,6 +9,10 @@ export function initSentry(dsn: string, environment: string) { }) } +export function sentryCaptureMessage(msg: string) { + return Sentry.captureMessage(msg) +} + export function sentryCaptureError(err: unknown) { return Sentry.captureException(err) }