uqbar-project / wollok

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

Improve wollok.lang.Exception stack trace printing #427

Closed javierfernandes closed 8 years ago

javierfernandes commented 8 years ago

Currently when a wollok program fails with a user throwing an exception it logs the java stack trace of the interpreter. Instead it should print the wollok stacktrace alone.

javierfernandes commented 8 years ago

Fixed in dev v1.3.0

npasserini commented 8 years ago

We still see the problem in version 1.3, cloned from dev on Nov. 30

javierfernandes commented 8 years ago

There are many different cases for this. @npasserini What's your scenario to reproduce it ?

tesonep commented 8 years ago

When I have this program


object apple {
    method energy() {
        return 150
    }
}

object birdSeed {
    method energy() {
        return 10
    }
}

object pepita {
    var energy = 100

    method fly(distance) {
        energy = energy - distance * 10
    }

    method eat(food) {
        energy += food.energy()
    }

    method energy(){
        return energy
    }
}

If I do in the REPL

pepita.fly(apple)

It produces:


Wollok interactive console (type "quit" to quit): 
>>> 
>>> pepita.fly(apple)
     WVM Error in line (1): pepita.fly(apple):
          WVM Error in line (15): {
        energy = energy - distance * 10
    }:
               WVM Error in line (16): energy = energy - distance * 10:
                    WVM Error in line (16): energy - distance * 10:
org.uqbar.project.wollok.interpreter.WollokRuntimeException: Error while resolving 100 - org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$10@198dacb5
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:70)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:1)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:711)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:147)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:675)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:145)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:138)
    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:141)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:668)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:149)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.eval(AbstractWollokCallable.java:136)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable$1.apply(AbstractWollokCallable.java:86)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.performOnStack(WollokInterpreter.java:187)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.call(AbstractWollokCallable.java:98)
    at org.uqbar.project.wollok.interpreter.core.WollokObject.call(WollokObject.java:113)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._call(WollokInterpreterEvaluator.java:800)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.call(WollokInterpreterEvaluator.java:907)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.perform(WollokInterpreterEvaluator.java:796)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:776)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:189)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:138)
    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:141)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:184)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:193)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator._evaluate(WollokLauncherInterpreterEvaluator.java:63)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:191)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.interpret(WollokInterpreter.java:141)
    at org.uqbar.project.wollok.launch.repl.WollokRepl.executeInput(WollokRepl.java:163)
    at org.uqbar.project.wollok.launch.repl.WollokRepl.startRepl(WollokRepl.java:86)
    at org.uqbar.project.wollok.launch.WollokLauncher.doSomething(WollokLauncher.java:43)
    at org.uqbar.project.wollok.launch.WollokChecker.doMain(WollokChecker.java:82)
    at org.uqbar.project.wollok.launch.WollokLauncher.main(WollokLauncher.java:29)
Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/home/pablo/dev/wollok/org.uqbar.project.wollok.updatesite/target/products/wollok-ide/linux/gtk/x86_64/workspace/Prueba/src/pepita.wlk:[18]: distance * 10
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:240)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$10.apply(WollokInterpreterEvaluator.java:720)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations.minusOperation(WollokDeclarativeNativeBasicOperations.java:172)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:58)
    ... 46 more
Caused by: org.uqbar.project.wollok.interpreter.WollokRuntimeException: Error while resolving apple[] * org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$10@25a78661
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:70)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:1)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:711)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:147)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    ... 54 more
Caused by: org.uqbar.project.wollok.interpreter.core.WollokProgramExceptionWrapper
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:337)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:175)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:132)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:138)
    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:141)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:668)
    at org.uqbar.project.wollok.launch.WollokLauncherInterpreterEvaluator.evaluate(WollokLauncherInterpreterEvaluator.java:149)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:228)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.eval(AbstractWollokCallable.java:136)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable$1.apply(AbstractWollokCallable.java:86)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.performOnStack(WollokInterpreter.java:187)
    at org.uqbar.project.wollok.interpreter.AbstractWollokCallable.call(AbstractWollokCallable.java:98)
    at org.uqbar.project.wollok.interpreter.core.WollokObject.call(WollokObject.java:113)
    at org.uqbar.project.wollok.interpreter.core.WollokObject.throwMessageNotUnderstood(WollokObject.java:157)
    at org.uqbar.project.wollok.interpreter.core.WollokObject.call(WollokObject.java:129)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations._multiply(WollokDeclarativeNativeBasicOperations.java:242)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations.multiply(WollokDeclarativeNativeBasicOperations.java:639)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations.multiplyOperation(WollokDeclarativeNativeBasicOperations.java:234)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.uqbar.project.wollok.interpreter.operation.WollokDeclarativeNativeBasicOperations$2.apply(WollokDeclarativeNativeBasicOperations.java:58)
    ... 58 more

>>> 
javierfernandes commented 8 years ago

Ok. Fixed in #459

screen shot 2015-12-01 at 10 43 40

Still travis cannot build the fix

https://travis-ci.org/uqbar-project/wollok/builds/94151756

Dec 01, 2015 1:24:16 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected [JSESSIONID="3A576CD4E835DD140083774EB2FCE82E", version:0, domain:subclipse.tigris.org, path:/servlets, expiry:null] Illegal path attribute "/servlets". Path of origin: "/update_1.10.x/p2.index"
[INFO] Adding repository http://subclipse.tigris.org/update_1.10.x
[ERROR] Failed to resolve target definition /home/travis/build/uqbar-project/wollok/org.uqbar.project.wollok.targetplatform/org.uqbar.project.wollok.targetplatform.target: Could not find "org.tmatesoft.svnkit.feature.group/1.8.10.r10446_v20150526_1454" in the repositories of the current location -> [Help 1]

I think it is a transient issue in the repos