Skip to content

Commit

Permalink
Merge pull request #54
Browse files Browse the repository at this point in the history
Log and exit for unhandled exceptions potentially related to redis
  • Loading branch information
uatuko authored Sep 16, 2023
2 parents cf213fd + f2872cc commit 96c7643
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/svc/access.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "access.h"

#include "err/errors.h"
#include "logger/logger.h"

namespace svc {
grpc::ServerUnaryReactor *Access::AddPolicyCollection(
Expand Down Expand Up @@ -44,6 +45,10 @@ grpc::ServerUnaryReactor *Access::Check(
const auto policies =
datastore::AccessPolicy::Cache::check(request->identity_id(), request->resource());
map(policies, response);
} catch (const std::exception &e) {
// FIXME: added to help debug unhandled exceptions, should be removed.
logger::critical("svc", "exception", e.what());
return reactor;
} catch (...) {
reactor->Finish(grpc::Status(grpc::StatusCode::UNAVAILABLE, "Failed to check access"));
return reactor;
Expand Down
5 changes: 5 additions & 0 deletions src/svc/rbac.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "rbac.h"

#include "err/errors.h"
#include "logger/logger.h"

namespace svc {
grpc::ServerUnaryReactor *Rbac::Check(
Expand All @@ -18,6 +19,10 @@ grpc::ServerUnaryReactor *Rbac::Check(
const auto policies =
datastore::RbacPolicy::Cache::check(request->identity_id(), request->permission());
map(policies, response);
} catch (const std::exception &e) {
// FIXME: added to help debug unhandled exceptions, should be removed.
logger::critical("svc", "exception", e.what());
return reactor;
} catch (...) {
reactor->Finish(grpc::Status(grpc::StatusCode::UNAVAILABLE, "Failed to check rbac"));
return reactor;
Expand Down

0 comments on commit 96c7643

Please sign in to comment.