diff --git a/unicorn/src/service/unicorn.cpp b/unicorn/src/service/unicorn.cpp index 05dd21b3..51e643da 100644 --- a/unicorn/src/service/unicorn.cpp +++ b/unicorn/src/service/unicorn.cpp @@ -73,15 +73,17 @@ class unicorn_slot_t : return result_dispatch_type(std::make_shared(service.name())); } - const auto identity = auth->identify(headers); - - if (auto ec = boost::get(&identity)) { + auth::identity_t identity; + try { + identity = auth->identify(headers); + } catch (const std::system_error& err) { COCAINE_LOG_WARNING(service.log, "failed to complete '{}' operation", Event::alias(), blackhole::attribute_list{ - {"code", ec->value()}, - {"error", ec->message()}, + {"code", err.code().value()}, + {"error", err.code().message()}, + {"reason", error::to_string(err)}, }); - upstream.template send(*ec, "permission denied"); + upstream.template send(err.code(), error::to_string(err)); return result_dispatch_type(std::make_shared(service.name())); }