Skip to content

Commit

Permalink
Add support for step fail, properly handle corresponding server err…
Browse files Browse the repository at this point in the history
…or (#134)

* Add support for step , properly handle corresponding error

* Bump version
  • Loading branch information
zhulik authored Nov 30, 2022
1 parent fb85ad8 commit 0fc6b15
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
grumlin (1.0.1)
grumlin (1.0.2)
async-pool (~> 0.3.0)
async-websocket (~> 0.22.0)
ibsciss-middleware (~> 0.4.0)
Expand Down Expand Up @@ -74,8 +74,6 @@ GEM
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri (1.13.9-x86_64-linux)
racc (~> 1.4)
oj (3.13.23)
overcommit (0.59.1)
childprocess (>= 0.6.3, < 5)
Expand Down
1 change: 1 addition & 0 deletions lib/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ steps:
- drop
- elementMap
- emit
- fail
- filter
- fold
- from
Expand Down
3 changes: 3 additions & 0 deletions lib/grumlin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def initialize(status, query)
# NOTE: Neptune does not return id.
end

class FailStepError < ServerError
end

class VertexAlreadyExistsError < AlreadyExistsError; end

class EdgeAlreadyExistsError < AlreadyExistsError; end
Expand Down
1 change: 1 addition & 0 deletions lib/grumlin/request_error_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Grumlin::RequestErrorFactory
ERRORS = {
499 => Grumlin::InvalidRequestArgumentsError,
500 => Grumlin::ServerError,
595 => Grumlin::FailStepError,
597 => Grumlin::ScriptEvaluationError,
599 => Grumlin::ServerSerializationError,
598 => Grumlin::ServerTimeoutError,
Expand Down
2 changes: 1 addition & 1 deletion lib/grumlin/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Grumlin
VERSION = "1.0.1"
VERSION = "1.0.2"
end
6 changes: 6 additions & 0 deletions spec/grumlin/request_error_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
end
end

context "when status is 595" do
let(:response) { { requestId: 123, status: { code: 595, message: "" } } }

include_examples "returns an exception", Grumlin::FailStepError
end

context "when status is 597" do
let(:response) { { requestId: 123, status: { code: 597, message: "" } } }

Expand Down

0 comments on commit 0fc6b15

Please sign in to comment.