github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/js/src/error.ts (about) 1 import { Exception } from '../proto/errors_pb'; 2 import { TxExecution } from '../proto/exec_pb'; 3 4 export class TxExecutionError extends Error { 5 public readonly code: number; 6 7 constructor(exception: Exception) { 8 super(exception.getException()); 9 this.code = exception.getCode(); 10 } 11 } 12 13 export function getException(txe: TxExecution): TxExecutionError | void { 14 const exception = txe.hasException() ? txe.getException() : undefined; 15 if (exception) { 16 return new TxExecutionError(exception); 17 } 18 }