Line data Source code
1 : /*
2 : * Package : Ethereum
3 : * Author : S. Hamblett <steve.hamblett@linux.com>
4 : * Date : 08/012/2017
5 : * Copyright : S.Hamblett
6 : *
7 : * A JSON RPC 2.0 client for Ethereum
8 : */
9 :
10 : part of ethereum;
11 :
12 : /// Manages Ethereum client errors
13 : class EthereumError {
14 :
15 : /// Constants
16 : static const String noError = "No Error";
17 : static const int noId = -1;
18 :
19 2 : EthereumError();
20 :
21 : /// Error code
22 : int _code = 0;
23 :
24 1 : int get code => _code;
25 :
26 : /// Error message
27 : String _message = noError;
28 :
29 1 : String get message => _message;
30 :
31 : /// Error transaction id
32 : int _id = noId;
33 :
34 2 : int get id => _id;
35 :
36 : /// Error timestamp
37 : DateTime _timestamp;
38 :
39 1 : DateTime get timestamp => _timestamp;
40 :
41 : void updateError(int errorCode, String errorMessage, int errorId) {
42 2 : _code = errorCode;
43 2 : _message = errorMessage;
44 2 : _id = errorId;
45 4 : _timestamp = new DateTime.now();
46 : }
47 :
48 : String toString() {
49 8 : return "Code : $_code <> Message : $_message <> Id : $_id";
50 : }
51 : }
|