replace panic! with internal_error! in compiler modules

This commit is contained in:
Jarl André Hübenthal 2023-05-02 18:33:15 +02:00
parent ba1f8ffe5f
commit e5eb5717ea
No known key found for this signature in database
11 changed files with 60 additions and 36 deletions

View file

@ -26,6 +26,7 @@ roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
bumpalo.workspace = true

View file

@ -2,6 +2,7 @@ use std::path::{Path, PathBuf};
#[cfg(not(windows))]
use bumpalo::Bump;
use roc_error_macros::internal_error;
use roc_module::symbol::ModuleId;
const SKIP_SUBS_CACHE: bool = {
@ -93,10 +94,10 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
let mut module = match res_module {
Ok(v) => v,
Err(LoadingProblem::FormattedReport(report)) => {
panic!("{}", report);
internal_error!("{}", report);
}
Err(other) => {
panic!("build_file failed with error:\n{:?}", other);
internal_error!("build_file failed with error:\n{:?}", other);
}
};
@ -109,7 +110,7 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
);
if problems.errors + problems.warnings > 0 {
panic!("Problems were found! Refusing to build cached subs.");
internal_error!("Problems were found! Refusing to build cached subs.");
}
let subs = module.solved.into_inner();