-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce nesting of wait for action attempt errors
- Loading branch information
1 parent
644f08b
commit 781f22b
Showing
3 changed files
with
26 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module Seam | ||
module Http | ||
module WaitForActionAttempt | ||
class ActionAttemptError < StandardError | ||
attr_reader :action_attempt | ||
class ActionAttemptError < StandardError | ||
attr_reader :action_attempt | ||
|
||
def initialize(message, action_attempt) | ||
super(message) | ||
@action_attempt = action_attempt | ||
end | ||
def initialize(message, action_attempt) | ||
super(message) | ||
@action_attempt = action_attempt | ||
end | ||
|
||
def name | ||
self.class.name | ||
end | ||
end | ||
def name | ||
self.class.name | ||
end | ||
end | ||
|
||
class FailedError < ActionAttemptError | ||
attr_reader :code | ||
class ActionAttemptFailedError < ActionAttemptError | ||
attr_reader :code | ||
|
||
def initialize(action_attempt) | ||
super(action_attempt.error.message, action_attempt) | ||
@code = action_attempt.error.type | ||
end | ||
end | ||
def initialize(action_attempt) | ||
super(action_attempt.error.message, action_attempt) | ||
@code = action_attempt.error.type | ||
end | ||
end | ||
|
||
class TimeoutError < ActionAttemptError | ||
def initialize(action_attempt, timeout) | ||
message = "Timed out waiting for action attempt after #{timeout}s" | ||
super(message, action_attempt) | ||
end | ||
end | ||
class ActionAttemptTimeoutError < ActionAttemptError | ||
def initialize(action_attempt, timeout) | ||
message = "Timed out waiting for action attempt after #{timeout}s" | ||
super(message, action_attempt) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters