tezos_client 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tezos_client/exceptions.rb +9 -6
- data/lib/tezos_client/operation_mgr.rb +2 -2
- data/lib/tezos_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a21029dab6eb8b945102361e51011ad6a580d80cee4bffe390b3280ccc901976
|
4
|
+
data.tar.gz: 8c1fa53542e21120978dc47629709b32f0ecbfc944ced46a7b85e434d2051260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a0bbbdaca9dd25288db693b6543b4c6c7be52927f8a423704e85633cd51028b14c5d502ea75798365891a9ed5f89e6cce7a4e6076c1df86963bb29423cdd5a3
|
7
|
+
data.tar.gz: a9e05d491808f5ddb3649bcaf50cba40c9142814966c85deaa35d6a1892d6bc55f419bf02c145c5b50984a0f23d1f7eca957cf210485c000d860b2f2f8756cc5
|
data/Gemfile.lock
CHANGED
@@ -52,6 +52,8 @@ class TezosClient
|
|
52
52
|
end
|
53
53
|
|
54
54
|
class TezBalanceTooLow < OperationFailure
|
55
|
+
FIRST_ERROR_REGEXP = /proto\.[^.]*\.contract\.balance_too_low/
|
56
|
+
|
55
57
|
attr_reader :contract
|
56
58
|
attr_reader :balance
|
57
59
|
attr_reader :amount
|
@@ -69,21 +71,22 @@ class TezosClient
|
|
69
71
|
end
|
70
72
|
|
71
73
|
class ScriptRuntimeError < OperationFailure
|
74
|
+
FIRST_ERROR_REGEXP = /proto.\d*-\w*\.(scriptRejectedRuntimeError|michelson_v\d\.runtime_error)/
|
75
|
+
ERROR_REGEXP = /proto.\d*-\w*\.(scriptRejectedRuntimeError|michelson_v\d\.script_rejected)/
|
76
|
+
|
72
77
|
attr_reader :location
|
73
78
|
attr_reader :with
|
74
79
|
attr_reader :contract
|
75
80
|
|
76
81
|
def initialize(metadata:, errors:, status:)
|
77
|
-
|
78
|
-
rejection_error = errors.detect { |error| error[:id]
|
82
|
+
first_error = errors[0]
|
83
|
+
rejection_error = errors.detect { |error| error[:id].match? ERROR_REGEXP }
|
79
84
|
|
80
85
|
@location = rejection_error[:location]
|
81
|
-
@contract =
|
86
|
+
@contract = first_error[:contractHandle]
|
82
87
|
@with = rejection_error[:with]
|
83
88
|
@message = "Script runtime Error when executing #{contract}: #{with} (location: #{location})"
|
84
89
|
super
|
85
90
|
end
|
86
91
|
end
|
87
|
-
|
88
|
-
|
89
|
-
end
|
92
|
+
end
|
@@ -164,9 +164,9 @@ class TezosClient
|
|
164
164
|
def exception_klass(errors)
|
165
165
|
error = errors[0]
|
166
166
|
case error[:id]
|
167
|
-
when
|
167
|
+
when TezBalanceTooLow::FIRST_ERROR_REGEXP
|
168
168
|
TezBalanceTooLow
|
169
|
-
when
|
169
|
+
when ScriptRuntimeError::FIRST_ERROR_REGEXP
|
170
170
|
ScriptRuntimeError
|
171
171
|
else
|
172
172
|
OperationFailure
|
data/lib/tezos_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tezos_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Michard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|