Skip to content

Commit

Permalink
Return parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
quangIO committed Jan 25, 2024
1 parent a95032e commit 4e29bf6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ impl RulesSet {
// # Safety: libmodsecurity must not reassign inner pointer
let r: i32 = unsafe { inner.as_mut().loadFromUri(path_str_c.as_ptr()).into() };
if r < 0i32 {
return Err(std::io::Error::from_raw_os_error(r))
.context(format!("Adding rule: {}", p.as_ref().display()));
let err = inner.as_mut().getParserError();
return Err(std::io::Error::from_raw_os_error(-r))
.context(format!("Adding rule: {} returns {}", p.as_ref().display(), err.to_string_lossy()));
}
}
Ok(Self { inner })
Expand Down

0 comments on commit 4e29bf6

Please sign in to comment.