Open mrjbq7 opened 9 years ago
Thanks for the feedback, @mrjbq7.
@nathansobo you were looking at first-mate recently -- would we consider tweaking first-mate so that it extracts the line
and column
number from the pegjs exception and adds it to the exception message
(probably here)? Or should we just tweak apm
to do that when it calls first-mate?
It makes sense to modify first mate to get that information. I'm somewhat surprised it's not already in the error message. We should just catch the exception and build/rethrow a new one with a better message.
I know this is an old issue but it is still open and unresolved, so I thought I'd try my hand at trying to fix it. I decided to apply the fix in APM since the information required to locate the source of the error is not made available to first-mate.
Additionally, it appears to be near impossible (or at least efficient) to ascertain an exact location of an error, so I elected to output the malformed piece of text instead, which should hopefully give enough information to the user to debug their program.
Seems to be duplicate of #23
I was not complaining about receiving the syntax error (that was just an example). Instead I was suggesting debugging it was hard without file name and line numbers available. I don't think this issue is duplicate of #23.
From first-mate's perspective it is the same as #23, if not duplicate, then certainly related. Conversion takes place in apm (and first-mate never sees the complete file being converted, thus being oblivious of any sort of positional information), which @FrederickGeek8 has taken care of in his pull request.
I was trying to convert Factor's textmate bundle to work with Atom and had an error while running
apm
:This error didn't say which file, nor which position in the file was having the syntax error, which made debugging really difficult. By process of elimination, I was able to remove files until I found the offending file, which was this version:
https://github.com/slavapestov/factor/blob/70428241bd2f6f96e31b121690f337c466bed942/misc/Factor.tmbundle/Snippets/%5B%20expanded.tmSnippet
The fix was to remove the extra newline after
source.factor
(https://github.com/slavapestov/factor/commit/2b1e7dd9d06f004e9b2f5a86b5d406cafd4185ef).Anyway, it would be super awesome if you could add file/line/column to the error messages.
Thanks!