[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom error handling




Etienne,

Thanks. All unit tests in our class library still pass after making the
change, so that's good, and when I hit my expected Exception, I get a much
better error message. Great!

regards,
kd


[kdowney@hamlet classlib]$ src/genunix/bin/runtests com.a3sr.rule.engine.ParserUnitTests
...com.a3sr.rule.engine.parser.ParserException: [1,18] expecting: 'and',
'or', ')'
	at com.a3sr.rule.engine.parser.Parser.parse(Parser.java:272)
	at
com.a3sr.rule.engine.ParserUnitTests.testParenMismatch(ParserUnitTests.java:56)
	at java.lang.reflect.Method.invoke(Native Method)
	at junit.framework.TestCase.runTest(TestCase.java:155)
	at junit.framework.TestCase.runBare(TestCase.java:129)
	at junit.framework.TestResult$1.protect(TestResult.java:100)
	at junit.framework.TestResult.runProtected(TestResult.java:117)
	at junit.framework.TestResult.run(TestResult.java:103)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.run(TestSuite.java:144)
	at junit.textui.TestRunner.doRun(TestRunner.java:61)
	at junit.textui.TestRunner.start(TestRunner.java:242)
	at junit.textui.TestRunner.main(TestRunner.java:94)
....
Time: 0.297

OK (7 tests)


> Hi Kyle,
>
> > ...For example, I'd rather
> > have "expecting 'and' or 'or'" rather than "TAnd TOr." ...
> >
> > Is there a way to do this I haven't found? I see back in May of last year
> > someone offered a patch to do just this, but no one replied and I assume
> > the patch is quite out of date now.
>
> I have made an experimental SableCC version that implements what you
> asked for.
>
> You will notice that I have chosen to switch SableCC's version numbering
> to the Linux scheme: major.minor.revision, where "minor" is even for
> stable versions and odd for experimental versions.
>
> Please try out SableCC 2.15.0, and let me know (on this list) if I
> should change anything before making it into a stable version (2.16.0).
>
> Hope this helps;-)
>
> Etienne
>