Skip to content

Commit

Permalink
Fix todo on error message
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Feb 3, 2024
1 parent c15cf27 commit 1c694a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct MyStruct {
number: f64,
string: String,
struct_in_struct: SubStruct,
tuple: (i32, u8)
tuple: (i32, u8),
}

#[derive(Reflect, Default, Debug)]
Expand All @@ -43,7 +43,7 @@ fn main() {
boolean: false,
enume: MyEnum::Tupleo("nooo".to_string(), 5.),
},
tuple: (-5, 255)
tuple: (-5, 255),
})
.register_type::<MyStruct>()
.add_plugins((
Expand Down
2 changes: 1 addition & 1 deletion src/builtin_parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ fn parse_expression(
tokens.next();

let index_name = tokens.slice().to_string();

tokens.next();

match tokens.next() {
Expand Down
6 changes: 5 additions & 1 deletion src/builtin_parser/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ pub fn run(ast: Ast, world: &mut World) {
Ok(value) => {
info!(name: COMMAND_RESULT_NAME, "{}{value}", crate::ui::COMMAND_RESULT_PREFIX)
}
Err(err) => error!("{err:?}"),
Err(err) => {
hints.push(err.hints());

error!("{}", err.message());
}
},
Err(err) => {
hints.push(err.hints());
Expand Down
2 changes: 1 addition & 1 deletion src/builtin_parser/runner/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl RunError {
CannotIndexValue(Spanned { span: _, value }) => {
format!("Cannot index {} with a member expression.", value.kind()).into()
}
ReferenceToMovedData(_) => todo!(),
ReferenceToMovedData(_) => "Cannot access reference to moved data.".into(),
VariableMoved(Spanned { value, .. }) => format!("Variable `{value}` was moved.").into(),
CannotDereferenceValue(Spanned { value: kind, .. }) => {
format!("Cannot dereference {kind}.").into()
Expand Down

0 comments on commit 1c694a6

Please sign in to comment.