A meta-processor that wraps a validator and produces a custom error in case the wrapped validator fails.
More...
#include <MetaProcessors.hpp>
|
| WithCustomError (RequirementOrModifierType reqOrModifier, Status err) |
| Constructs a validator that calls the given validator req and returns a custom error err in case req fails.
|
|
MaybeError | verify (boost::json::value const &value, std::string_view key) const |
| Runs the stored validator and produces a custom error if the wrapped validator fails.
|
|
MaybeError | verify (boost::json::value &value, std::string_view key) const |
| Runs the stored validator and produces a custom error if the wrapped validator fails. This is an overload for the requirement which can modify the value. Such as IfType.
|
|
MaybeError | modify (boost::json::value &value, std::string_view key) const |
| Runs the stored modifier and produces a custom error if the wrapped modifier fails.
|
|
template<typename RequirementOrModifierType>
requires SomeRequirement<RequirementOrModifierType> or SomeModifier<RequirementOrModifierType>
class rpc::meta::WithCustomError< RequirementOrModifierType >
A meta-processor that wraps a validator and produces a custom error in case the wrapped validator fails.
◆ WithCustomError()
template<typename RequirementOrModifierType >
Constructs a validator that calls the given validator req
and returns a custom error err
in case req
fails.
- Parameters
-
reqOrModifier | The requirement to validate against |
err | The custom error to return in case req fails |
◆ modify()
template<typename RequirementOrModifierType >
Runs the stored modifier and produces a custom error if the wrapped modifier fails.
- Parameters
-
value | The JSON value representing the outer object. This value can be modified by the modifier. |
key | The key used to retrieve the element from the outer object |
- Returns
- Possibly an error
◆ verify() [1/2]
template<typename RequirementOrModifierType >
Runs the stored validator and produces a custom error if the wrapped validator fails. This is an overload for the requirement which can modify the value. Such as IfType.
- Parameters
-
value | The JSON value representing the outer object, this value can be modified by the requirement inside |
key | The key used to retrieve the element from the outer object |
- Returns
- Possibly an error
◆ verify() [2/2]
template<typename RequirementOrModifierType >
Runs the stored validator and produces a custom error if the wrapped validator fails.
- Parameters
-
value | The JSON value representing the outer object |
key | The key used to retrieve the element from the outer object |
- Returns
- Possibly an error
The documentation for this class was generated from the following file: