All files / common error.ts

79.48% Statements 31/39
100% Branches 1/1
0% Functions 0/1
79.48% Lines 31/39

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 401x 1x 1x 1x                 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
export class CodeError extends Error {
  code: number
  message: any
  constructor(code: number, msg?: any) {
    super(msg)
    this.code = code
    if (msg) {
      this.message = msg
    } else {
      this.message = 'CodeError:' + code
    }
  }
}
 
export enum ErrCode {
  EC_OK = 0,
  EC_INNER_ERROR = -1,
  EC_INVALID_ARGUMENT = -2,
  EC_SENSIBLE_API_ERROR = -3,
  EC_INVALID_SIGNERS = -4,
 
  //需要特殊处理
  EC_UTXOS_MORE_THAN_3 = -100,
  EC_TOO_MANY_FT_UTXOS = -101,
  EC_FIXED_TOKEN_SUPPLY = -102,
 
  //金额不足
  EC_INSUFFICIENT_BSV = -200,
  EC_INSUFFICIENT_FT = -201,
 
  EC_NFT_NOT_ON_SELL = -300,
}
 
export const ErrInfo = {
  InvalidArgument: {
    code: ErrCode.EC_INVALID_ARGUMENT,
    message: '',
  },
}