Merge remote-tracking branch 'upstream/master' into pr/Demonthos/482

This commit is contained in:
Demonthos committed 2022-07-02 19:03:08 -05:00
commit de3e2a48f8
4 files changed
+73 -46

No files matched your search

+17
View File
@@ -1,3 +1,5 @@
use std::fmt::Display;
use serde::{Deserialize, Serialize};
use crate::CodeLocation;
@@ -38,3 +40,18 @@ impl ParseError {
ParseError { message, location }
}
}
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::ParseError(error) => write!(
f,
"parse error:\n--> at {}:{}:{}\n\t{:?}\n",
error.location.file_path, error.location.line, error.location.column, error.message
),
Error::RecompileRequiredError(reason) => {
write!(f, "recompile required: {:?}\n", reason)
}
}
}
}
+2
View File
@@ -150,6 +150,8 @@ impl RsxContext {
fn report_error(&self, error: Error) {
if let Some(handler) = &self.data.write().unwrap().error_handler {
handler.handle_error(error)
} else {
panic!("no error handler set for this platform...\n{}", error);
}
}