Skip to content

Commit

Permalink
sqf: fix handling of preprocessor error (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson authored Nov 11, 2024
1 parent 664f567 commit f6e6a80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion bin/src/modules/sqf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ impl Module for SQFCompiler {
.map(|(addon, entry)| {
trace!("sqf compiling {}", entry);
let mut report = Report::new();
let processed = Processor::run(entry).map_err(|(_, e)| e)?;
let processed = match Processor::run(entry).map_err(|(_, e)| e) {
Ok(p) => p,
Err(e) => {
if let hemtt_preprocessor::Error::Code(code) = e {
report.push(code);
return Ok(report);
}
return Err(e.into());
}
};
for warning in processed.warnings() {
report.push(warning.clone());
}
Expand Down
2 changes: 1 addition & 1 deletion libs/preprocessor/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use hemtt_workspace::reporting::Code;
#[derive(thiserror::Error, Debug)]
/// Errors that can occur during preprocessing
pub enum Error {
#[error("Coded error")]
#[error("Coded error: {0:?}")]
/// A coded error
Code(Arc<dyn Code>),
#[error("IO Error: {0}")]
Expand Down

0 comments on commit f6e6a80

Please sign in to comment.