Class: WebFunction::DocumentedError
- Inherits:
-
Object
- Object
- WebFunction::DocumentedError
- Defined in:
- lib/web_function/documented_error.rb
Overview
# DocumentedError
Represents an error definition as described in a Web Function package.
An error definition documents the possible errors that an endpoint might return, including a machine-readable error code and a human-readable description.
See the [error definition documentation] on the Web Function website for more details, including recognized keys and usage recommendations.
Instance Method Summary collapse
-
#code ⇒ String
## Code.
-
#docs ⇒ String
## Docs.
-
#initialize(error) ⇒ DocumentedError
constructor
A new instance of DocumentedError.
Constructor Details
#initialize(error) ⇒ DocumentedError
Returns a new instance of DocumentedError.
15 16 17 |
# File 'lib/web_function/documented_error.rb', line 15 def initialize(error) @error = error end |
Instance Method Details
#code ⇒ String
## Code
The code of the error.
25 26 27 |
# File 'lib/web_function/documented_error.rb', line 25 def code @error["code"] end |
#docs ⇒ String
## Docs
The documentation of the error.
35 36 37 |
# File 'lib/web_function/documented_error.rb', line 35 def docs @error["docs"].to_s end |