mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 14:18:15 +00:00
Shell: Show descriptions about syntax errors
The description contains an error message and where in the source the error happened.
This commit is contained in:
committed by
Andreas Kling
parent
034be8e74c
commit
d6de2b5828
@@ -325,8 +325,10 @@ int Shell::run_command(const StringView& cmd)
|
||||
return 0;
|
||||
|
||||
if (command->is_syntax_error()) {
|
||||
// FIXME: Provide descriptive messages for syntax errors.
|
||||
fprintf(stderr, "Shell: Syntax error in command\n");
|
||||
auto& error_node = command->syntax_error_node();
|
||||
auto& position = error_node.position();
|
||||
fprintf(stderr, "Shell: Syntax error in command: %s\n", error_node.error_text().characters());
|
||||
fprintf(stderr, "Around '%.*s'\n", (int)min(position.end_offset - position.start_offset, (size_t)10), cmd.characters_without_null_termination() + position.start_offset);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user