Skip to content

Commit

Permalink
add handlerApiError()
Browse files Browse the repository at this point in the history
  • Loading branch information
scrypt committed Sep 20, 2023
1 parent ac99323 commit 53abc46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/contracts/ordinal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -198,7 +198,7 @@ export class Ordinal extends SmartContractLib {
})
.catch(function (error) {
// handle error
console.log(error)
handlerApiError(error)
return null
})
}
Expand All @@ -214,7 +214,7 @@ export class Ordinal extends SmartContractLib {
})
.catch(function (error) {
// handle error
console.log(error)
handlerApiError(error)
return null
})

Expand All @@ -236,7 +236,7 @@ export class Ordinal extends SmartContractLib {
})
.catch(function (error) {
// handle error
console.log(error)
handlerApiError(error)
return null
})

Expand Down Expand Up @@ -270,8 +270,7 @@ export class Ordinal extends SmartContractLib {
return []
})
.catch(function (error) {
// handle error
console.log(error)
handlerApiError(error)
return []
})
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

0 comments on commit 53abc46

Please sign in to comment.