Open zhangzq opened 3 years ago
Hi!
Looks like you get a std::length_error
somewhere in your request-handler. That exception is caught by RESTinio and logger.
It's hard to help you because I don't know anything about your code. You can try to place the code in your request-handler into try-catch block:
auto my_request_handler(const restinio::request_handle_t & req) {
try {
... // Your code here.
}
catch(const std::exception & x) {
std::cerr << "Oops! " << x.what() << std::endl; // (1)
}
}
Then set a breakpoint at (1).
Is there an MACRO -- not to catch the exception and let the app core dump, then let me check the error stack (in gdb)?
No, there is no such a macro.
You can comment try/catch blocks here: https://github.com/Stiffstream/restinio/blob/0052518f5692f8f051031e06d933b726191be97e/dev/restinio/impl/connection.hpp#L741-L749
Hi!
Looks like you get a
std::length_error
somewhere in your request-handler. That exception is caught by RESTinio and logger.It's hard to help you because I don't know anything about your code. You can try to place the code in your request-handler into try-catch block:
auto my_request_handler(const restinio::request_handle_t & req) { try { ... // Your code here. } catch(const std::exception & x) { std::cerr << "Oops! " << x.what() << std::endl; // (1) } }
Then set a breakpoint at (1).
Breakpoint at (1) won't provide the error stack.
No, there is no such a macro.
You can comment try/catch blocks here:
Thanks. I comment/uncomment using #ifdef DBUG
, but get catched by some other place and show error messsage:
unexpected exception during the handling of incoming data: basic_string::_M_replace_aux
Breakpoint at (1) won't provide the error stack.
Oops. Ok. Let's try something like that:
class dummy_breakpoint {
bool commited_{false};
public:
dummy_breakpoint() = default;
~dummy_breakpoint() { if(!commited_) std::abort(); } // or just throw std::runtime_error("my exception");
void commit() { commited_ = true; }
};
// Then in your request-handler:
auto my_request_handler(const restinio::request_handle_t & req) {
dummy_breakpoint breakpoint;
...
const auto res = req->create_response(...)...;
dummy_breakpoint.commit();
return res;
}
My app showed me an error message:
I didn't know where the error cames from (even I compiled in debug mode and run in gdb). What should I do?