mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-29 08:14:07 +00:00
add proper error messages for ingested files
This commit is contained in:
parent
62fcc71be3
commit
e5b88366fe
5 changed files with 86 additions and 25 deletions
|
@ -1,4 +1,6 @@
|
|||
//! Provides types to describe problems that can occur during solving.
|
||||
use std::{path::Path, str::Utf8Error};
|
||||
|
||||
use roc_can::expected::{Expected, PExpected};
|
||||
use roc_module::{ident::Lowercase, symbol::Symbol};
|
||||
use roc_problem::{can::CycleEntry, Severity};
|
||||
|
@ -29,6 +31,8 @@ pub enum TypeError {
|
|||
expected_opaque: Symbol,
|
||||
found_opaque: Symbol,
|
||||
},
|
||||
IngestedFileBadUtf8(Box<Path>, Utf8Error),
|
||||
IngestedFileUnsupportedType(Box<Path>, ErrorType),
|
||||
}
|
||||
|
||||
impl TypeError {
|
||||
|
@ -48,6 +52,8 @@ impl TypeError {
|
|||
TypeError::Exhaustive(exhtv) => exhtv.severity(),
|
||||
TypeError::StructuralSpecialization { .. } => RuntimeError,
|
||||
TypeError::WrongSpecialization { .. } => RuntimeError,
|
||||
TypeError::IngestedFileBadUtf8(..) => Fatal,
|
||||
TypeError::IngestedFileUnsupportedType(..) => Fatal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue