Skip to content

Commit

Permalink
don't crash if http request failed
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Mar 4, 2022
1 parent 6a753c2 commit ec94770
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion base/module/src/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ void timer::exec(boost::system::error_code const& ec) {

auto access_copy = access_;
dispatcher_->enqueue(
ctx_data{dispatcher_}, [self = shared_from_this()]() { self->fn_(); },
ctx_data{dispatcher_},
[self = shared_from_this()]() {
try {
self->fn_();
} catch (std::exception const& e) {
LOG(logging::error)
<< "error in timer " << self->name_ << ": " << e.what();
} catch (...) {
LOG(logging::error) << "unknown error in timer " << self->name_;
}
},
ctx::op_id{name_, CTX_LOCATION, 0U}, ctx::op_type_t::IO,
std::move(access_copy));

Expand Down

0 comments on commit ec94770

Please sign in to comment.