console, internal/jsre: colorize JavaScript exceptions too

This commit is contained in:
Péter Szilágyi
2016-05-11 17:28:29 +03:00
parent ffaf58f0a9
commit 14ae5708d6
4 changed files with 37 additions and 12 deletions

View File

@ -303,11 +303,11 @@ func (self *JSRE) Evaluate(code string, w io.Writer) error {
self.Do(func(vm *otto.Otto) {
val, err := vm.Run(code)
if err != nil {
fail = err
prettyError(vm, err, w)
} else {
prettyPrint(vm, val, w)
fmt.Fprintln(w)
}
fmt.Fprintln(w)
})
return fail
}