Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

Transformers in easy_parser should have an ability to fail #99

Closed eao197 closed 3 years ago

eao197 commented 4 years ago

In the versions up to 0.6.8 transformers in RESTinio's easy_parser has the following format:

Output_Type transformer(Input_Type &&)

where Output_Type can't have and error indication. For example, there could be a transformer:

int to_integer(std::string && from)

and the only way to indicate a conversion failure is to throw an exception.

This is not good. In some cases, it's required to have an ability to return an error description from the transformer. So a transformer should have the following format:

expected_t<Output_Type, error_reason_t> transformer(Input_Type &&);
eao197 commented 3 years ago

Fixed in v.0.6.11.