Exception: Arcp::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Arcp::Error
show all
- Defined in:
- lib/arcp/errors.rb
Direct Known Subclasses
Arcp::Errors::AgentNotAvailable, Arcp::Errors::AgentVersionNotAvailable, Arcp::Errors::Backpressure, Arcp::Errors::BudgetExhausted, Arcp::Errors::Cancelled, Arcp::Errors::DuplicateKey, Arcp::Errors::HeartbeatLost, Arcp::Errors::Internal, Arcp::Errors::InvalidRequest, Arcp::Errors::JobNotFound, Arcp::Errors::LeaseExpired, Arcp::Errors::LeaseSubsetViolation, Arcp::Errors::PermissionDenied, Arcp::Errors::ProtocolViolation, Arcp::Errors::RateLimited, Arcp::Errors::ResumeWindowExpired, Arcp::Errors::Timeout, Arcp::Errors::Unauthenticated, Arcp::Errors::UnnegotiatedFeature
Constant Summary
collapse
- CODE =
'INTERNAL_ERROR'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(message = nil, details: {}) ⇒ Error
Returns a new instance of Error.
9
10
11
12
|
# File 'lib/arcp/errors.rb', line 9
def initialize(message = nil, details: {})
@details = details.freeze
super(message || self.class.default_message)
end
|
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
7
8
9
|
# File 'lib/arcp/errors.rb', line 7
def details
@details
end
|
Class Method Details
.default_message ⇒ Object
24
|
# File 'lib/arcp/errors.rb', line 24
def self.default_message = name.split('::').last.gsub(/([a-z])([A-Z])/, '\1 \2').downcase
|
Instance Method Details
#code ⇒ Object
14
|
# File 'lib/arcp/errors.rb', line 14
def code = self.class::CODE
|
#retryable? ⇒ Boolean
15
|
# File 'lib/arcp/errors.rb', line 15
def retryable? = false
|
#to_payload(trace_id: nil) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/arcp/errors.rb', line 17
def to_payload(trace_id: nil)
payload = { code: code, message: message, retryable: retryable? }
payload[:details] = details unless details.empty?
payload[:trace_id] = trace_id if trace_id
payload
end
|