Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting #40

Open
elkowar opened this issue May 3, 2021 · 6 comments
Open

Improve error reporting #40

elkowar opened this issue May 3, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@elkowar
Copy link

elkowar commented May 3, 2021

Fennel provides fennel.traceback, which can provide more ergonomic, readable and pleasing error messages. This is already being used in aniseed.eval, where the errors will be printed nicely.
When using aniseed for the vim configuration however, errors don't run through traceback, thus showing rather ugly and unhelpful lua error messages.

Wrapping the configuration in an xpcall that defers errors to fennels traceback handler should be pretty simple to implement, and would already drastically improve the experience of configuring vim in fennel.

This would still not affect any deferred execution, and thus wouldn't affect anything that's called on keybinds, autocmds, or passed as callbacks to other functions. This could be improved in several ways:

  • Simply provide an easy-to-use function to wrap custom functions in, that wraps the function you're calling in xpcall for you. This would require actively doing it, and would make it an "always-on" thing, which is both suboptimal. BUT: it would be rather trivial.
  • Try to automatically wrap functions by possibly using the fennel compiler plugin API (?). This would work automatically and allow the user to toggle it on and off depending on "development" vs "in-use" state. It would however also bring more extreme performance issues, and probably also change behaviour of code in many places where code relies on how errors behave.
  • Try to intercept errors at a higher level, overriding the traceback handler that vim uses to print it's errors. lua has debug.traceback, but from what I can tell that's not what is being used here (although I can't be sure, haven't looked into it). At least from my primitive tests, just overriding that function changed nothing.
@Olical
Copy link
Owner

Olical commented May 8, 2021

Just commenting to highlight for passers by that we've previously talked a little about this on Discord and I totally agree. Will be looking into this soon I hope! (lots to do, picking and choosing my battles carefully!)

@Olical Olical added the enhancement New feature or request label May 31, 2021
@Kethku
Copy link

Kethku commented Sep 12, 2021

I'm running into this problem where on one of my machines my fennel config completely fails on startup with an unhelpful error message:
image

But on the other it works fine. Unfortunately I have no idea what is causing this and I don't really even know how to approach figuring out what is going on. Do you have any tips for how to get better error messages in the meantime? Its preventing me from using aniseed which has been amazing in the past...

@Olical
Copy link
Owner

Olical commented Sep 12, 2021

🤔 I don't think I have enough information to go on here, I can't really make any guesses. First of all, are you on a stable release or develop? Since develop is fragile at the moment as I make sweeping changes.

You could also try removing ~/.config/nvim/lua entirely and have nvim rebuild it just in case something is hanging on that shouldn't be there or isn't recompiling?

@Kethku
Copy link

Kethku commented Sep 12, 2021

First off, it was late when I posted that, so I want to reiterate that this is almost certainly an issue on my config or with the fact that I'm using windows. My question was more about how I might get some more useful debug information out of the system. Seems like neovim just eats the relevant information when getting errors from lua.

I'm motivated to get my system working because I think the project is really promising :) Aniseed is great

I have tried with both develop and master branches. And I have rebuilt the lua from scratch by deleting the lua folder and having nvim rebuild, with no luck... Is there a way to force aniseed to use the above aniseed.traceback on a temporary basis?

@Kethku
Copy link

Kethku commented Sep 12, 2021

For some extra context, I reverted my config changes to the previous stable state and I still have issues. So I'm thinking there is something sticking around. I tried removing my nvim-data folder so that it is built from scratch with no luck. Is it possible that there is some other scripts/files sticking around somewhere that aniseed loads other than what is stored in the .config (actually appdata/local/nvim on windows) folder or the nvim-data folder?

@Kethku
Copy link

Kethku commented Sep 12, 2021

Ok I've figured out some more details. The issue seems to be windows specific and is unrelated to this issue. Sorry to hijack. I will create a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants