diff --git a/docs/guides/error-handling.md b/docs/guides/error-handling.md index 999307c2ab..f9b8829acc 100644 --- a/docs/guides/error-handling.md +++ b/docs/guides/error-handling.md @@ -99,7 +99,6 @@ BaseError │ │ TagNotFoundError │ │ TxNotInChainError │ │ UnknownTxError -│ │ UnsignedTxError │ │ UnsupportedABIversionError │ │ UnsupportedVMversionError │ diff --git a/src/tx/tx-object.js b/src/tx/tx-object.js index e590ea52c9..50ef1e2a8f 100644 --- a/src/tx/tx-object.js +++ b/src/tx/tx-object.js @@ -9,13 +9,7 @@ import { buildTx, calculateFee, unpackTx } from './builder' import { TX_TYPE } from './builder/schema' import { encode } from './builder/helpers' import { isHex } from '../utils/string' -import { - InvalidTxError, - TypeError, - UnknownTxError, - InvalidSignatureError, - UnsignedTxError -} from '../utils/errors' +import { InvalidTxError, TypeError, UnknownTxError, InvalidSignatureError } from '../utils/errors' /** * Build transaction from object @@ -152,7 +146,6 @@ export const TxObject = stampit({ * @return {Array} Array of signatures */ getSignatures () { - if (!this.isSigned) throw new UnsignedTxError() return this.signatures }, /** diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 4133752a42..70aa1da9d3 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -572,7 +572,7 @@ export class IllegalBidFeeError extends TransactionError { export class InvalidSignatureError extends TransactionError { constructor (message: string) { super(message) - this.name = 'UnsignedTxError' + this.name = 'InvalidSignatureError' } } @@ -639,13 +639,6 @@ export class UnknownTxError extends TransactionError { } } -export class UnsignedTxError extends TransactionError { - constructor () { - super('Signature not found, transaction is not signed') - this.name = 'UnsignedTxError' - } -} - export class UnsupportedABIversionError extends TransactionError { constructor (message: string) { super(message) diff --git a/test/unit/tx-object.js b/test/unit/tx-object.js index 5b9c0a0c76..8baabc4a1a 100644 --- a/test/unit/tx-object.js +++ b/test/unit/tx-object.js @@ -21,11 +21,7 @@ import { TX_TYPE } from '../../src/tx/builder/schema' import { generateKeyPair } from '../../src/utils/crypto' import MemoryAccount from '../../src/account/memory' import { - InvalidSignatureError, - InvalidTxError, - TypeError, - UnknownTxError, - UnsignedTxError + InvalidSignatureError, InvalidTxError, TypeError, UnknownTxError } from '../../src/utils/errors' describe('TxObject', () => { @@ -87,10 +83,7 @@ describe('TxObject', () => { tx.isSigned.should.be.equal(true) }) - it('Get signature on unsigned tx', () => { - expect(() => txObject.getSignatures()) - .to.throw(UnsignedTxError, 'Signature not found, transaction is not signed') - }) + it('Get signature on unsigned tx', () => expect(txObject.getSignatures()).to.eql([])) it('Invalid props', () => { expect(() => txObject.setProp(true)).to.throw(TypeError, 'Props should be an object')