Skip to content

Commit

Permalink
fix: adapt with core changes (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
3Hren authored Mar 29, 2017
1 parent da2c0d9 commit 918766c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions unicorn/src/service/unicorn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ class unicorn_slot_t :
return result_dispatch_type(std::make_shared<unicorn_dispatch_t>(service.name()));
}

const auto identity = auth->identify(headers);

if (auto ec = boost::get<std::error_code>(&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<typename protocol::error>(*ec, "permission denied");
upstream.template send<typename protocol::error>(err.code(), error::to_string(err));
return result_dispatch_type(std::make_shared<unicorn_dispatch_t>(service.name()));
}

Expand Down

0 comments on commit 918766c

Please sign in to comment.