diff --git a/runtime/v8/sourcemap.go b/runtime/v8/sourcemap.go index c6a0fbe..4c5eacb 100644 --- a/runtime/v8/sourcemap.go +++ b/runtime/v8/sourcemap.go @@ -69,13 +69,14 @@ func clearSourceMaps() { // PrintException print the exception func PrintException(method string, args []interface{}, jserr *v8go.JSError, rootMapping interface{}) { - ex := exception.New(jserr.Message, 500) - color.Red("\n----------------------------------") - color.Red("Script Exception: %s", fmt.Sprintf("%d %s", ex.Code, ex.Message)) - color.Red("----------------------------------") - color.Red("%s\n", StackTrace(jserr, rootMapping)) if runtimeOption.Debug { + ex := exception.New(jserr.Message, 500) + color.Red("\n----------------------------------") + color.Red("Script Exception: %s", fmt.Sprintf("%d %s", ex.Code, ex.Message)) + color.Red("----------------------------------") + + color.Red("%s\n", StackTrace(jserr, rootMapping)) fmt.Println(color.YellowString("\nMethod:"), color.WhiteString("%s", method)) color.Yellow("Args:") raw, _ := jsoniter.MarshalToString(args) @@ -88,11 +89,6 @@ func StackTrace(jserr *v8go.JSError, rootMapping interface{}) string { ex := exception.New(jserr.Message, 500) - // Production mode will not show the stack trace - if runtimeOption.Debug == false { - return fmt.Sprintf("%d %s", ex.Code, ex.Message) - } - // Development mode will show the stack trace entries := parseStackTrace(jserr.StackTrace) if entries == nil || len(entries) == 0 {