Add option to choose between restc-cpp and nap
I don't think this is very clean, but they might fix the bug in restc-cpp that is currently holding this project back, and I might want to go back to it. I might refactor this into a virtual class.
This commit is contained in:
parent
8b09d7da53
commit
80bfbc640a
9 changed files with 182 additions and 42 deletions
|
@ -16,8 +16,11 @@
|
|||
*/
|
||||
|
||||
#include "timer_oro_api.hpp"
|
||||
#include "orotool_config.hpp"
|
||||
#include "oro/api.hpp"
|
||||
#include <restc-cpp/error.h>
|
||||
#if defined(OROTOOL_WITH_RESTCCPP)
|
||||
# include <restc-cpp/error.h>
|
||||
#endif
|
||||
#include <exception>
|
||||
|
||||
namespace duck {
|
||||
|
@ -66,6 +69,7 @@ inline void TimerOroApi<Op>::fetch_data() {
|
|||
set_next_timer(results.first);
|
||||
this->update_db(results.second, results.first);
|
||||
}
|
||||
#if defined(OROTOOL_WITH_RESTCCPP)
|
||||
catch (const restc_cpp::RequestFailedWithErrorException& err) {
|
||||
status_code = err.http_response.status_code;
|
||||
if (429 == err.http_response.status_code) {
|
||||
|
@ -75,6 +79,7 @@ inline void TimerOroApi<Op>::fetch_data() {
|
|||
throw err;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
catch (...) {
|
||||
this->set_exception(std::current_exception());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue