-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FABN-1566 Add TransactionError with event status (#258)
When a transaction completes with a non-valid status the error object will be of type TransactionError which will include the transactionCode and transactionId attribute. Signed-off-by: Bret Harrison <[email protected]>
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2020 IBM All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import { FabricError } from './fabricerror'; | ||
|
||
export interface TransactionErrorInfo { | ||
message: string; | ||
transactionId: string; | ||
transactionCode: string; | ||
} | ||
|
||
/** | ||
* Base type for Fabric-specific errors. | ||
* @memberof module:fabric-network | ||
* @property {string} [transactionId] ID of the associated transaction. | ||
* @property {string} [transactionCode] The transaction validation code of the associated transaction. | ||
*/ | ||
export class TransactionError extends FabricError { | ||
transactionCode?: string; | ||
|
||
/* | ||
* Constructor. | ||
* @param {(string|object)} [info] Either an error message (string) or additional properties to assign to this | ||
* instance (object). | ||
*/ | ||
constructor(info?: string | TransactionErrorInfo) { | ||
super(info); | ||
this.name = TransactionError.name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters