myna-parser icon indicating copy to clipboard operation
myna-parser copied to clipboard

ParserError messages don't seem to be propogated

Open Fleker opened this issue 4 years ago • 3 comments

A grammar I'm developing seems to be throwing a ParserError, although I'm having a lot of trouble finding out exactly where the error is happening. To make matters more complicated, I seem to be unable to see the error messages that are coming out of the ParserError. It seems like the message parameter is not being propogated to the error object or accessible in the console.

Here's a simple test case.

> try { throw new Error('123') } catch (e) { console.error(e.toString()) }
Error: 123
undefined
> try { throw new ParserError('123') } catch (e) { console.error(e.toString()) }
Error

Fleker avatar Sep 16 '19 17:09 Fleker

Seems like you're calling super(message), although that doesn't seem to be having an effect. But manually setting the message property in the constructor does seem to have an effect.

Fleker avatar Sep 16 '19 17:09 Fleker

I get much better behavior on TypeScript 3.0+, so I think my dependency on this is out of date.

Fleker avatar Sep 16 '19 17:09 Fleker

Actually, now that I look at it some more, I'm going to reopen this. It seems like there hasn't been a release since the Typescript dependency has been updated, so this issue is still open.

Fleker avatar Sep 16 '19 17:09 Fleker