Skip to content

Commit

Permalink
fix: fixed wrong macro checking for ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
worapolw committed Nov 14, 2023
1 parent 7166191 commit 655cd05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/enforcer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,28 +235,28 @@ impl Enforcer {
let r_ast = get_or_err_with_context!(
self,
"r",
ctx.r_type,
&ctx.r_type,
ModelError::R,
"request"
);
let p_ast = get_or_err_with_context!(
self,
"p",
ctx.p_type,
&ctx.p_type,
ModelError::P,
"policy"
);
let m_ast = get_or_err_with_context!(
self,
"m",
ctx.m_type,
&ctx.m_type,
ModelError::M,
"matcher"
);
let e_ast = get_or_err_with_context!(
self,
"e",
ctx.e_type,
&ctx.e_type,
ModelError::E,
"effector"
);
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ macro_rules! get_or_err_with_context {
$msg
)))
})?
.get(&format!("{}{}", $key, $ctx))
.get($ctx)
.ok_or_else(|| {
$crate::error::Error::from($err(format!(
"Missing {} section in conf file",
Expand Down

0 comments on commit 655cd05

Please sign in to comment.