Skip to content

Adding multiline attachments/contexts to Report #195

Description

@CommentatorForAll

I'd like to have a way of properly adding multiline attachments/contexts to an error.
Currently, when passing in a multiline string, the \n will get renedered as \n instead of proper newlines.

While i understand that this is the best behavior in most cases, this is annoying when passing through pre-rendered exceptions, like toml deser errors which come formatted.

My current workaround is to do a err.to_string().spllit("\n") and adding each line as its own attachment. This is ugly and not at all what one should be doing.

Current error message:

 ● "FormatError: \u{1b}[31;1merror:\u{1b}[0m bad machine specification: failed to convert column #\u{1b}[35;1m3\u{1b}[0m in a row: '\u{1b}[35;1m                    hello world this is a very much invalid file\u{1b}[0m' to 'unsigned int'"
 ├ lix/lix-rs/src/machines.rs:218
 ├ 
 │  ● "while deserializing TOML"
 │  ├ lix/lix-rs/src/machines.rs:197
 │  │
 │  ● "TOML parse error at line 2, column 27\n  |\n2 |                     hello world this is a very much invalid file\n  |                           ^\nkey with no value, expected `=`\n"
 │  ╰ lix/lix-rs/src/machines.rs:196
 ╰ "\n                    hello world this is a very much invalid file\n                    for both amazingly stupid formats\n                    and i am having a buuuuuunch of fun writ

error message i'd like:

 ● "FormatError: \u{1b}[31;1merror:\u{1b}[0m bad machine specification: failed to convert column #\u{1b}[35;1m3\u{1b}[0m in a row: '\u{1b}[35;1m                    hello world this is a very much invalid file\u{1b}[0m' to 'unsigned int'"
 ├ lix/lix-rs/src/machines.rs:223
 ├ 
 │  ● "while deserializing toml"
 │  ├ lix/lix-rs/src/machines.rs:197
 │  ├ "TOML parse error at line 2, column 27"
 │  │ "  |"
 │  │ "2 |                     hello world this is a very much invalid file"
 │  │ "  |                           ^"
 │  │ "key with no value, expected `=`"
 │  ╰ ""
 ╰ "\n                    hello world this is a very much invalid file\n                    for both amazingly stupid formats\n                    and i am having a buuuuuunch of fun writing this test file\n                "

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions