Base
Base class for error response wrappers.
Error wrappers structure responses for validation errors and other error conditions. Extend this class to customize how errors are wrapped in your API responses.
Example: Custom error wrapper
ruby
class MyErrorWrapper < Wrapper::Error::Base
shape do
extends(data_type)
end
def wrap
data
end
endClass Methods
.shape
.shape(klass_or_callable = nil, &block)
Defines the response shape for contract generation.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
klass_or_callable | Class<Shape>, Proc, nil | nil | A Shape subclass or callable. |
Returns
Class<Shape>, nil
Instance Methods
#data
#data
The data for this wrapper.
Returns
Hash
#wrap
#wrap
Transforms the data into the final response format.
Returns
Hash