Closed GreasySlug closed 1 year ago
When error position is on the right side and the error description sentence is long, the whole sentence becomes longer to the right.
4 │ mut_arr = [1, 2, 3, 4, 5].into [Int!; !5]
-----
╰─ AttributeError: Array({1, 4, 3, 5, 2, }, 5) object has no attribute into
Specify the width to align these to the left.
4 │ mut_arr = [1, 2, 3, 4, 5].into [Int!; !5]
· -----
· ╭────────────────────────╯
· ╰─ AttributeError: Array({1, 4, 3, 5, 2, }, 5) object has no attribute into
Consider direct fix #2? @GreasySlug Let @mtshiba make some suggestions?
No, color and formats only Maybe we should work on this..
I'm trying to make it easier for #2 to color and modify as needed with this format.
I'm in the process of looking into several error handling libraries to do this.
~No, color and formats only~ Maybe we should work on this.. I'm trying to make it easier for #2 to color and modify as needed with this format. I'm in the process of looking into several error handling libraries to do this.
When error position is on the right side and the error description sentence is long, the whole sentence becomes longer to the right.
4 │ mut_arr = [1, 2, 3, 4, 5].into [Int!; !5] ----- ╰─ AttributeError: Array({1, 4, 3, 5, 2, }, 5) object has no attribute into
Specify the width to align these to the left.
4 │ mut_arr = [1, 2, 3, 4, 5].into [Int!; !5] ╭──────────────────────────----- ╰─ AttributeError: Array({1, 4, 3, 5, 2, }, 5) object has no attribute into
Same as #2 on this, we need more than one opinion. Adding a type will inevitably lengthen error description. User type may cause very long types error like Rust. Then the format can't handle it.
That is OK for now.
Ultimately, the error message is split into two parts: the main message and the submessage. The submessage is simple and appears directly below the code block. The main message is longer and more detailed and appears at the end.
The format will be like:
n | invalid_code
____________
╰─ sub message
ErrorKind: main message
That is OK for now.
Ultimately, the error message is split into two parts: the main message and the submessage. The submessage is simple and appears directly below the code block. The main message is longer and more detailed and appears at the end.
The format will be like:
n | invalid_code ____________ ╰─ sub message ErrorKind: main message
That's good to see. How do you plan to separate error messages into sub and main messages?
That's good to see. How do you plan to separate error messages into sub and main messages?
I am thinking like:
#[derive(...)]]
pub struct ErrorCore {
pub sub_messages: Vec<Submessage>,
pub main_message: AtomicStr
...
}
#[derive(...)]]
pub struct Submessage {
pub loc: Location,
msg: AtomicStr,
}
This changes also involve displaying errors across multiple code blocks. Let's merge this PR and then open it as a separate PR.
Thank you so much!
Fix: #2.
Intro
The error handling code you wrote was very clear and abstract. But what I am rewriting now is not. This code is pretty dirty and you can just discard it.
Changes proposed in this PR
I want to reformat like following.
: `- NameError: ::mut_content_arr(: Failure) is not defined
Error[#0572]: File .\examples\array.er, line 10, in
: `- NameError: ::telescoping_arr(: Failure) is not define
Error[#0357]: File, line 1, in
: `- NameError: print is not defined
hint: exists a similar name variable: print!
Default is ANSI color and ASCII.
The above will use unicode chars and custom colors.
unicode
: use╰
,─
,·
and│
pretty
: use emoji and custom colors This is a experimental addition to prove that changes can be made Custom colors are put on in order to set up coloring for CVD(Color Vision Deficiency) etc. in the future, and will be separated frompretty
original error format
default format
unicode and pretty format
@mtshiba