statelydb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/common/net/conn.rb +9 -1
- data/lib/error.rb +20 -9
- 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: d085f703fae0e0d968fe62788d74409d67b487025c76eca89589ded2b985794f
|
4
|
+
data.tar.gz: 3f9a0a0e029cb375f970eb2acfea662aced22501302758eedd5c7938ae6ebe26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fac13f5e528c452d3a69f305cfef78e34374f58913125a2ac9291656427ff8895ff303baa29c4244150b1e69dadf8bbadc13520bb02297de34c8e38801da35bc
|
7
|
+
data.tar.gz: 2c2f9ee717d50aef99d135c1316e7c3947617592246122461888b2bbb111c3f3204f9677fbef3cf8f33c1e5d04cecb1a4fecbfa99aaa44a772138e79b1663257
|
data/lib/common/net/conn.rb
CHANGED
@@ -19,7 +19,15 @@ module StatelyDB
|
|
19
19
|
else
|
20
20
|
creds.compose(call_creds)
|
21
21
|
end
|
22
|
-
GRPC::Core::Channel.new(endpoint_uri.authority, {
|
22
|
+
GRPC::Core::Channel.new(endpoint_uri.authority, {
|
23
|
+
# 2x the default of 8kb = 16kb
|
24
|
+
# Set max and absolute max to the same value
|
25
|
+
# to stop the grpc lib changing the error code to ResourceExhausted
|
26
|
+
# while still successfully reading the metadata because only the soft
|
27
|
+
# limit was exceeded.
|
28
|
+
"grpc.max_metadata_size" => 8192 * 2,
|
29
|
+
"grpc.absolute_max_metadata_size" => 8192 * 2
|
30
|
+
}, creds)
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
data/lib/error.rb
CHANGED
@@ -22,14 +22,7 @@ module StatelyDB
|
|
22
22
|
# @param [String] stately_code
|
23
23
|
# @param [Exception] cause
|
24
24
|
def initialize(message, code: nil, stately_code: nil, cause: nil)
|
25
|
-
|
26
|
-
code_str = if code > 0
|
27
|
-
GRPC::Core::StatusCodes.constants.find do |c|
|
28
|
-
GRPC::Core::StatusCodes.const_get(c) === code
|
29
|
-
end.to_s.split("_").collect(&:capitalize).join
|
30
|
-
else
|
31
|
-
"Unknown"
|
32
|
-
end
|
25
|
+
code_str = self.class.grpc_code_to_string(code)
|
33
26
|
|
34
27
|
super("(#{code_str}/#{stately_code}): #{message}")
|
35
28
|
@code = code
|
@@ -50,13 +43,31 @@ module StatelyDB
|
|
50
43
|
raw_detail = status.details[0]
|
51
44
|
if raw_detail.type_url == "type.googleapis.com/stately.errors.StatelyErrorDetails"
|
52
45
|
error_details = Stately::Errors::StatelyErrorDetails.decode(raw_detail.value)
|
46
|
+
upstream_cause = error_details.upstream_cause.empty? ? nil : StandardError.new(error_details.upstream_cause) # rubocop:disable Metrics/BlockNesting
|
53
47
|
return new(error_details.message, code: error.code, stately_code: error_details.stately_code,
|
54
|
-
cause:
|
48
|
+
cause: upstream_cause)
|
55
49
|
end
|
56
50
|
end
|
57
51
|
end
|
58
52
|
|
59
53
|
new(error.message, code: GRPC::Core::StatusCodes::UNKNOWN, stately_code: "Unknown", cause: error)
|
60
54
|
end
|
55
|
+
|
56
|
+
def code_string
|
57
|
+
self.class.grpc_code_to_string(@code)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Turn a gRPC status code into a human-readable string. e.g. 3 -> "InvalidArgument"
|
61
|
+
# @param [Integer] code
|
62
|
+
# @return [String]
|
63
|
+
def self.grpc_code_to_string(code)
|
64
|
+
if code > 0
|
65
|
+
GRPC::Core::StatusCodes.constants.find do |c|
|
66
|
+
GRPC::Core::StatusCodes.const_get(c) === code
|
67
|
+
end.to_s.split("_").collect(&:capitalize).join
|
68
|
+
else
|
69
|
+
"Unknown"
|
70
|
+
end
|
71
|
+
end
|
61
72
|
end
|
62
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statelydb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stately Cloud, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|