From 53abc468e1510d5ea955494b78e26f3fd557ffd5 Mon Sep 17 00:00:00 2001 From: scrypt Date: Wed, 20 Sep 2023 21:05:20 +0800 Subject: [PATCH] add handlerApiError() --- src/contracts/ordinal.ts | 11 +++++------ src/utils.ts | 3 +++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/contracts/ordinal.ts b/src/contracts/ordinal.ts index 79834a8..0e03eb5 100644 --- a/src/contracts/ordinal.ts +++ b/src/contracts/ordinal.ts @@ -18,7 +18,7 @@ import { import { Shift10 } from 'scrypt-ts-lib' import superagent from 'superagent' import { BSV20Protocol, Inscription } from '../types' -import { fromByteString } from '../utils' +import { fromByteString, handlerApiError } from '../utils' export class Ordinal extends SmartContractLib { @method() @@ -198,7 +198,7 @@ export class Ordinal extends SmartContractLib { }) .catch(function (error) { // handle error - console.log(error) + handlerApiError(error) return null }) } @@ -214,7 +214,7 @@ export class Ordinal extends SmartContractLib { }) .catch(function (error) { // handle error - console.log(error) + handlerApiError(error) return null }) @@ -236,7 +236,7 @@ export class Ordinal extends SmartContractLib { }) .catch(function (error) { // handle error - console.log(error) + handlerApiError(error) return null }) @@ -270,8 +270,7 @@ export class Ordinal extends SmartContractLib { return [] }) .catch(function (error) { - // handle error - console.log(error) + handlerApiError(error) return [] }) } diff --git a/src/utils.ts b/src/utils.ts index fcd71e8..39e5e02 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -9,3 +9,6 @@ export function fromByteString(bs: ByteString): string { const encoder = new TextDecoder() return encoder.decode(Buffer.from(bs, 'hex')) } + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export function handlerApiError(e: Error) {}