Skip to content

Quote problematic embed-code command when error occurs #18

@alexander-yevsyukov

Description

@alexander-yevsyukov

Currently, when code embedding fails because it's not possible for find a matching start or end line specified in a command, we got an error which looks like this:

jekyll 3.8.7 | Error:  There is no line matching `Pattern satic {`.
/Users/sanders/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/embed-code-eb18b3b9c6c5/lib/commands/embedding_instruction.rb:106:in `match_glob': There is no line matching `Pattern satic {`. (RuntimeError)
        from /Users/sanders/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/embed-code-eb18b3b9c6c5/lib/commands/embedding_instruction.rb:89:in `matching_lines'
        from /Users/sanders/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/embed-code-eb18b3b9c6c5/lib/commands/embedding_instruction.rb:80:in `content'
        from /Users/sanders/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/embed-code-eb18b3b9c6c5/lib/commands/embedding.rb:254:in `render_sample'
...

The cause of the error is that I made a mistake in the word static. But information provided in the error message is not enough for quickly finding a problematic command.

As a minimum, we need to give:

  1. The name of the file where the error occurred.
  2. Line number with the error.

It would be good to have a column number where the error occurred.

Ideally, it would be good:

  • display the whole command which failed;
  • highlight with red color the problematic string when printing to the screen console, and point with ^ when writing to a text file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions