uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Improve stack trace rendering. #292

Closed npasserini closed 8 years ago

npasserini commented 9 years ago

Currently it shows a lot of confusing information, for example:

 org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/test.wtest:[9]: test "socio con más libros prestados" {
   juancito.prestar(elTunel)
   juancito.prestar(aventurasDeTintin)
   carlitos.prestar(asterixYObelix)

   assert.equals(juancito, biblioteca.socioConMasLibros())
 }
   at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
   at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:137)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:1)
  at org.eclipse.xtext.xbase.lib.IteratorExtensions.fold(IteratorExtensions.java:627)
  at org.eclipse.xtext.xbase.lib.IterableExtensions.fold(IterableExtensions.java:536)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalAll(WollokInterpreterEvaluator.java:140)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator._evaluate(WollokLauncherInterpreterEvaluator.java:62)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:159)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.interpret(WollokInterpreter.java:112)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.interpret(WollokInterpreter.java:99)
  at org.uqbar.project.wollok.launch.WollokLauncher.doSomething(WollokLauncher.java:39)
  at org.uqbar.project.wollok.launch.WollokChecker.doMain(WollokChecker.java:81)
  at org.uqbar.project.wollok.launch.WollokLauncher.main(WollokLauncher.java:29)
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/test.wtest:[14]: assert.equals(juancito, biblioteca.socioConMasLibros())
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:137)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:1)
  at org.eclipse.xtext.xbase.lib.IteratorExtensions.fold(IteratorExtensions.java:627)
  at org.eclipse.xtext.xbase.lib.IterableExtensions.fold(IterableExtensions.java:536)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalAll(WollokInterpreterEvaluator.java:140)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator._evaluate(WollokLauncherInterpreterEvaluator.java:76)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:163)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 13 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/test.wtest:[14]: biblioteca.socioConMasLibros()
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$2.apply(WollokInterpreterEvaluator.java:146)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$2.apply(WollokInterpreterEvaluator.java:1)
  at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:42)
  at com.google.common.collect.Lists$TransformingRandomAccessList.get(Lists.java:572)
  at java.util.AbstractList$Itr.next(AbstractList.java:358)
  at java.util.AbstractCollection.toArray(AbstractCollection.java:196)
  at com.google.common.collect.Iterables.toArray(Iterables.java:314)
  at org.eclipse.xtext.xbase.lib.Conversions.unwrapArray(Conversions.java:96)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalEach(WollokInterpreterEvaluator.java:149)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:690)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:157)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 22 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[16]: {
    return usuarios.max[u | usuarios.queLibrosTiene().size() ]
  }
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.eval(AbstractWollokCallable.java:126)
  at org.uqbar.project.wollok.interpreter.AbstractWollokCallable$1.apply(AbstractWollokCallable.java:98)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.performOnStack(WollokInterpreter.java:155)
  at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.call(AbstractWollokCallable.java:110)
  at org.uqbar.project.wollok.interpreter.core.WollokObject.call(WollokObject.java:103)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._call(WollokInterpreterEvaluator.java:725)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.call(WollokInterpreterEvaluator.java:813)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.perform(WollokInterpreterEvaluator.java:721)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:691)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:157)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 35 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[17]: return usuarios.max[u | usuarios.queLibrosTiene().size() ]
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:137)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:1)
  at org.eclipse.xtext.xbase.lib.IteratorExtensions.fold(IteratorExtensions.java:627)
  at org.eclipse.xtext.xbase.lib.IterableExtensions.fold(IterableExtensions.java:536)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalAll(WollokInterpreterEvaluator.java:140)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:596)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:117)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 46 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[17]: usuarios.max[u | usuarios.queLibrosTiene().size() ]
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:405)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:137)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 55 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[17]: usuarios.queLibrosTiene().size()
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.core.WollokClosure$2.apply(WollokClosure.java:89)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.performOnStack(WollokInterpreter.java:155)
  at org.uqbar.project.wollok.interpreter.core.WollokClosure.apply(WollokClosure.java:92)
  at org.uqbar.project.wollok.interpreter.nativeobj.WollokJavaConversions$2.apply(WollokJavaConversions.java:26)
  at org.uqbar.project.wollok.ui.utils.XTendUtilExtensions.collectComparing(XTendUtilExtensions.java:190)
  at org.uqbar.project.wollok.ui.utils.XTendUtilExtensions.maxBy(XTendUtilExtensions.java:158)
  at org.uqbar.project.wollok.interpreter.nativeobj.collections.AbstractWollokCollection.max(AbstractWollokCollection.java:141)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:497)
  at org.uqbar.project.wollok.interpreter.nativeobj.AbstractWollokDeclarativeNativeObject.call(AbstractWollokDeclarativeNativeObject.java:44)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._call(WollokInterpreterEvaluator.java:725)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.call(WollokInterpreterEvaluator.java:813)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.perform(WollokInterpreterEvaluator.java:721)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:691)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:157)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 59 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[17]: usuarios.queLibrosTiene().size()
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:137)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:1)
  at org.eclipse.xtext.xbase.lib.IteratorExtensions.fold(IteratorExtensions.java:627)
  at org.eclipse.xtext.xbase.lib.IterableExtensions.fold(IterableExtensions.java:536)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalAll(WollokInterpreterEvaluator.java:140)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:596)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:117)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 77 more
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/npasserini/apps/wollok/new/workspace/parcial-20150929-biblioteca/src/biblioteca.wlk:[17]: usuarios.queLibrosTiene()
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:203)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:131)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluateTarget(WollokInterpreterEvaluator.java:710)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evaluateTarget(WollokInterpreterEvaluator.java:800)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:687)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:157)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 86 more
Caused by: org.uqbar.project.wollok.interpreter.MessageNotUnderstood: [carlitos[librosPrestados=WList[asterixYObelix[]]], juancito[librosPrestados=WList[elTunel[], aventurasDeTintin[]]], maria[]] does not understand queLibrosTiene
    biblioteca.biblioteca.socioConMasLibros():17

  at org.uqbar.project.wollok.ui.utils.XTendUtilExtensions.invoke(XTendUtilExtensions.java:236)
  at org.uqbar.project.wollok.interpreter.nativeobj.AbstractWollokWrapperNativeObject.doesNotUnderstand(AbstractWollokWrapperNativeObject.java:31)
  at org.uqbar.project.wollok.interpreter.nativeobj.AbstractWollokDeclarativeNativeObject.call(AbstractWollokDeclarativeNativeObject.java:39)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._call(WollokInterpreterEvaluator.java:725)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.call(WollokInterpreterEvaluator.java:813)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.perform(WollokInterpreterEvaluator.java:721)
  at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:691)
  at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:157)
  at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:191)
  ... 92 more
npasserini commented 9 years ago

Java lines should not be there, we should reduce it to wollok lines. This is a start, then we could think about which is the best way to display a stack trace.

javierfernandes commented 8 years ago

I think that we have most of the scenarios covered. Message not understood raises a wollok exception. Also calling a native method throws a wollok exception (this includes assertions for tests) Same for binary operations.

Maybe we are missing the null pointer. And we will also want to implement the assertions as specific subclasses of wollok.lang.Exception. But for the moment I'll close this one. Those should be specific issues to report and address