anycable 0.4.3 → 0.4.4

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: d4c8d5a17b2fdbb6c0bbd0d6e83654c4bd42f8a8
4
- data.tar.gz: 9c8dcf6244537cdb0f8596fa1bbe036fbc949c4f
3
+ metadata.gz: e07569569f2ca894f95d64651ff38f73ffeed061
4
+ data.tar.gz: 68a013beec17cb6793ad976afafa5997529f7ce1
5
5
  SHA512:
6
- metadata.gz: 3138dae66b1b8eef2462384c4c0d5d8bfa189762dc785e7188dc3e8427839bad632af183924d402dad8b29fcfe745723cd93756dfe8ac60d6053c79fcc44662a
7
- data.tar.gz: 65ec89f8cb16c4d0a1c669c62c0e1d83efe19d57d332b666fec9e65f181322f4185b55f1476b5b9dc5ef57e32db69c44daf2e24c7ea05030ddb3a121ee18726c
6
+ metadata.gz: aecf9c7806fcb493a98cbd4312902d45482a1a3c8fbf3c414bbf7ec54ff994fabb5f3df413ffe1f7b3137338e3eb97f21f52fd041bec42af1136247d501842d9
7
+ data.tar.gz: f2b07fd79ef4a1f1e5b8b960415580baca0a4dd88d1ecaaf1363d9ee8df423f33f2da7e9f91ef88785a4a806b527dd1eb09f42fcea21beca22425f5ac274ab8a
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 0.4.4 (2017-03-06)
4
+
5
+ - Handle `StandardError` gracefully in RPC calls. ([@palkan][])
6
+
3
7
  ## 0.4.3 (2017-02-18)
4
8
 
5
9
  - Update `grpc` version dependency to support Ruby 2.4. ([@palkan][])
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anycable
4
+ module Handler
5
+ # Handle app-level errors
6
+ module ExceptionsHandling
7
+ def connect(*)
8
+ super
9
+ rescue StandardError => e
10
+ logger.error(e.message)
11
+ Anycable::ConnectionResponse.new(status: Anycable::Status::ERROR)
12
+ end
13
+
14
+ def disconnect(*)
15
+ super
16
+ rescue StandardError => e
17
+ logger.error(e.message)
18
+ Anycable::DisconnectResponse.new(status: Anycable::Status::ERROR)
19
+ end
20
+
21
+ def command(*)
22
+ super
23
+ rescue StandardError => e
24
+ logger.error(e.message)
25
+ Anycable::CommandResponse.new(status: Anycable::Status::ERROR)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,11 +3,15 @@ require 'anycable/socket'
3
3
  require 'anycable/rpc/rpc'
4
4
  require 'anycable/rpc/rpc_services'
5
5
 
6
+ require 'anycable/handler/exceptions_handling'
7
+
6
8
  # rubocop:disable Metrics/AbcSize
7
9
  # rubocop:disable Metrics/MethodLength
8
10
  module Anycable
9
11
  # RPC service handler
10
12
  class RPCHandler < Anycable::RPC::Service
13
+ prepend Handler::ExceptionsHandling
14
+
11
15
  # Handle connection request from WebSocket server
12
16
  def connect(request, _unused_call)
13
17
  logger.debug("RPC Connect: #{request}")
@@ -43,7 +47,7 @@ module Anycable
43
47
  if connection.handle_close
44
48
  Anycable::DisconnectResponse.new(status: Anycable::Status::SUCCESS)
45
49
  else
46
- Anycable::ConnectionResponse.new(status: Anycable::Status::ERROR)
50
+ Anycable::DisconnectResponse.new(status: Anycable::Status::ERROR)
47
51
  end
48
52
  end
49
53
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Anycable
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anycable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - palkan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-18 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: anyway_config
@@ -171,6 +171,7 @@ files:
171
171
  - circle.yml
172
172
  - lib/anycable.rb
173
173
  - lib/anycable/config.rb
174
+ - lib/anycable/handler/exceptions_handling.rb
174
175
  - lib/anycable/pubsub.rb
175
176
  - lib/anycable/rpc/rpc.rb
176
177
  - lib/anycable/rpc/rpc_services.rb