Sometimes, while developing scripts/plugins you have a chain of errors error1->error2->error3 but ´v:errmsg` only store the last error.
It would be handy to change the type of v:errmsg from string to list<string>, along the line of v:errors which is already a list<string>. It would be even better if the stored information contains the filename and the line where the errors occurred.
As alternative, one could read :messages but that is not so handy when it comes to automate tasks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It seems good, but it is not backward compatible.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Btw errmsg is singular, while errors is plural. So the request doesn't make sense grammartically. I think there should be a new variable instead
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This is not backwards compatible.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
What about adding another variable as suggested then?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I am not a fan of adding another variable, it adds to the confusion, I already don't know when to use what. Is there a reason you cannot use v:errors then?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Is there a reason you cannot use v:errors then?
I think they are fundamentally different. v:errors only save errors of assert_ functions. Maybe OP wants a variable that can save any error messages of the Vim session. This would be useful in testing plugin for example, if tests fail you may want to print all error messages possible to help debugging the problem.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I think they are fundamentally different.
v:errorsonly save errors ofassert_functions. Maybe OP wants a variable that can save any error messages of the Vim session. This would be useful in testing plugin for example, if tests fail you may want to print all error messages possible to help debugging the problem.
This. Also, note that v:errors is a list (which makes lot of sense!) but it only logs assertion errors, whereas v:errmsg is a string and saves only the last error message. It is a weird design IMO but I can take that historically v:errmsg came before v:errors. I take a bit less that we won't improve it due to retro-compatibility. As it is now, as a workaround I am reading the list of all messages set by Vim from :messages but it is a very ugly workaround. And we have two error management systems with one logging into a list and one taking only the last error message (in reality there is a third based on thrown exception but we can safely skip it for now).
Regarding retro-compatibility, I think the change is not big, and those who finds their scripts broken can easily fix it.
Also, regarding retro-compatibility policy, it would be nice to have a clear policy.
For example:
#18066 <- this is a bug, but for keeping retro-compatibility has not been fixed
#19301 <- this issue were due to a bug that has been fixed (with good peace for retro-compatibility, in-fact I have been hit due to retro-compatibility break. And TBH I was perfectly fine with such a change)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()