Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqf: fix handling of preprocessor error #837

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading