Exception: WebStruct::BodyTooLargeError
- Inherits:
-
StandardError
- Object
- StandardError
- WebStruct::BodyTooLargeError
- Defined in:
- lib/webstruct/errors.rb
Overview
Raised when the HTTP response body exceeds Http.get‘s :max_body_bytes limit.
Note: With the default Faraday adapter the full body may already be buffered in memory before this is raised.
Instance Attribute Summary collapse
-
#actual_bytes ⇒ Integer
readonly
Observed body size in bytes.
-
#max_bytes ⇒ Integer
readonly
Configured maximum body size in bytes.
Instance Method Summary collapse
-
#initialize(max_bytes, actual_bytes) ⇒ BodyTooLargeError
constructor
A new instance of BodyTooLargeError.
Constructor Details
#initialize(max_bytes, actual_bytes) ⇒ BodyTooLargeError
Returns a new instance of BodyTooLargeError.
22 23 24 25 26 |
# File 'lib/webstruct/errors.rb', line 22 def initialize(max_bytes, actual_bytes) @max_bytes = max_bytes @actual_bytes = actual_bytes super("Response body exceeds #{max_bytes} bytes, is #{actual_bytes} bytes.") end |
Instance Attribute Details
#actual_bytes ⇒ Integer (readonly)
Returns observed body size in bytes.
18 19 20 |
# File 'lib/webstruct/errors.rb', line 18 def actual_bytes @actual_bytes end |
#max_bytes ⇒ Integer (readonly)
Returns configured maximum body size in bytes.
15 16 17 |
# File 'lib/webstruct/errors.rb', line 15 def max_bytes @max_bytes end |