krpc 0.4.0.beta1 → 0.4.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8d2668d37ed41486d38de335c5d77eb9fbf7ea4
4
- data.tar.gz: 76ccaf2af65825e916d3202ba06be94cc8c5d9a9
3
+ metadata.gz: 1e7d575d4a1dbb6498787b0e82a39730f94f0d0d
4
+ data.tar.gz: 79568d6c4d305a5921ebc5c4c646825ccf484f73
5
5
  SHA512:
6
- metadata.gz: fa42767df76f7f37d10e493ecfed5fcde5bb23a7b5e2d07b944f7e15ff1ef98c89c00b997326d318a4503b0159f03e7c681184cefd22e309afa574cabef0d20e
7
- data.tar.gz: 449e4c7cd429e6b5bb10e05559ebf1692a59d0a5044f60a71912c19e623ffdd8183391b7f98854308846e17de6b0e2c2e98823ed345bc907ed8e2dba23d48ec4
6
+ metadata.gz: c23caec29dd780b472326b178f914db6b9b6751c7e109d05df181c9cb3a45bc55cbecf2f0fff2f624f4ad7e2e67740285307ea000a3b3a76db574453a7463ac0
7
+ data.tar.gz: 9b6725253fe71724ed3ceb2b22280a46bda329a339fb2d05b8bcda88f2fd6e5515883cd030547e8d326b3d8d3b06eb986cef375895a26a33b8f99eb17fcc4531
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.homepage = "https://github.com/TeWu/krpc-rb"
16
16
  s.license = "GPL-3.0"
17
17
 
18
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|bin/TestServer)/|Rakefile|CHANGELOG}) || f.start_with?('.') }
18
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(doc|test|spec|features|bin)/|Rakefile|CHANGELOG}) || f.start_with?('.') }
19
19
  s.require_paths = ["lib"]
20
20
  s.extra_rdoc_files = ["README.md"]
21
21
  s.rdoc_options << "--markup" << "markdown" <<
@@ -107,7 +107,7 @@ module KRPC
107
107
  # client.close
108
108
  def generate_services_api!
109
109
  return self if services_api_generated?
110
- raise(Exception, "Can't generate the services API while not connected to a server -- call Client#connect! to connect to server and generate the services API in one call") if not connected?
110
+ raise(Error, "Can't generate the services API while not connected to a server -- call Client#connect! to connect to server and generate the services API in one call") if not connected?
111
111
 
112
112
  resp = core.get_services
113
113
  resp.services.each do |service_msg|
@@ -139,7 +139,7 @@ module KRPC
139
139
  nil
140
140
  end
141
141
  rescue IOError => e
142
- raise(Exception, "RPC call attempt while not connected to a server -- call Client#connect first") if not connected?
142
+ raise(Error, "RPC call attempt while not connected to a server -- call Client#connect first") if not connected?
143
143
  raise e
144
144
  end
145
145
 
@@ -1,12 +1,20 @@
1
1
 
2
2
  module KRPC
3
3
 
4
- class ConnectionError < Exception; end
5
- class RPCError < Exception; end
6
- class ValueError < Exception; end
7
- class ProcedureNameParserError < Exception; end
4
+ class Error < Exception; end
5
+ class UTF8MessageError < Error
6
+ def initialize(msg = nil)
7
+ super(msg.nil? ? msg : msg.encode(Encoding::UTF_8, invalid: :replace, undef: :replace))
8
+ end
9
+ end
10
+
11
+ class ConnectionError < UTF8MessageError; end
12
+ class RPCError < UTF8MessageError; end
13
+ class ValueError < Error; end
14
+ class ProcedureNameParserError < Error; end
8
15
 
9
16
 
17
+ class ArgumentError < Error; end
10
18
  class ArgumentErrorSig < ArgumentError
11
19
  attr_reader :message_without_signature, :signature
12
20
 
@@ -62,7 +62,7 @@ module KRPC
62
62
  define_singleton_method method_name do |*args|
63
63
  Gen.transform_exceptions(cls, method_name, prepend_self_to_args) do
64
64
  raise ArgumentErrorSig.new("missing argument for parameter \"client\"") if args.count < 1
65
- raise ArgumentErrorSig.new("argument for parameter \"client\" must be a #{KRPC::Client.name} -- got #{args.first.inspect} of type #{args.first.class}") unless args.first.is_a?(KRPC::Client)
65
+ raise ArgumentErrorSig.new("argument for parameter \"client\" must be a #{::KRPC::Client.name} -- got #{args.first.inspect} of type #{args.first.class}") unless args.first.is_a?(::KRPC::Client)
66
66
  client = args.shift
67
67
  kwargs = args.extract_kwargs!
68
68
  client.execute_rpc(service_name, proc.name, args, kwargs, param_names, param_types, param_default, return_type: return_type)
@@ -3,7 +3,7 @@ module KRPC
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
5
  PATCH = 0
6
- LABEL = 'beta1'
6
+ LABEL = 'beta2'
7
7
  end
8
8
 
9
9
  VERSION = ([Version::MAJOR, Version::MINOR, Version::PATCH, Version::LABEL].compact * '.').freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: krpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.beta1
4
+ version: 0.4.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Więch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-24 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -184,4 +184,3 @@ signing_key:
184
184
  specification_version: 4
185
185
  summary: Client library for kRPC
186
186
  test_files: []
187
- has_rdoc: