fix some error strings

This commit is contained in:
Sebastien Bourdeauducq 2022-02-28 11:10:33 +08:00
parent 804d5db27e
commit a9c73a4915
2 changed files with 4 additions and 4 deletions

View File

@ -500,7 +500,7 @@ impl Nac3 {
.register_top_level(stmt.clone(), Some(resolver.clone()), path.clone())
.map_err(|e| {
CompileError::new_err(format!(
"nac3 compilation failure\n----------\n{}",
"compilation failed\n----------\n{}",
e
))
})?;
@ -586,7 +586,7 @@ impl Nac3 {
// report error of __modinit__ separately
if !e.contains("__nac3_synthesized_modinit__") {
return Err(CompileError::new_err(format!(
"nac3 compilation failure: \n----------\n{}",
"compilation failed\n----------\n{}",
e
)));
} else {

View File

@ -454,7 +454,7 @@ impl InnerResolver {
pyo3::types::PyModule::import(py, "builtins").unwrap().getattr("repr").unwrap();
let str_repr: String = str_fn.call1((pyty,)).unwrap().extract().unwrap();
Ok(Err(format!(
"{} is not supported in nac3 (did you forgot to put @nac3 annotation?)",
"{} is not registered with NAC3 (@nac3 decorator missing?)",
str_repr
)))
}
@ -931,7 +931,7 @@ impl SymbolResolver for Resolver {
let py_id =
self.0.name_to_pyid.get(&id).ok_or(format!("Undefined identifier `{}`", id))?;
let result = self.0.pyid_to_def.read().get(py_id).copied().ok_or(format!(
"`{}` is not registered in nac3, did you forgot to add @nac3?",
"`{}` is not registered with NAC3 (@nac3 decorator missing?)",
id
))?;
self.0.id_to_def.write().insert(id, result);