From f7e3eff09d418743757fb187638d8a302da8426e Mon Sep 17 00:00:00 2001 From: zyxkad Date: Thu, 22 Feb 2024 16:20:04 -0700 Subject: [PATCH] fix NaN issue --- analyzer.go | 2 +- cmd/mcla_wasm/utils.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/analyzer.go b/analyzer.go index b1c16d5..a7ceec7 100644 --- a/analyzer.go +++ b/analyzer.go @@ -49,7 +49,7 @@ func (a *Analyzer) DoError(jerr *JavaError) (matched []SolutionPossibility, err } } if len(e.Message) == 0 { // when ignore error message, error type provide 100% score weight - sol.Match /= 10 / 100 + sol.Match /= 10.0 / 100 } else { jemsg, _ := split(jerr.Message, '\n') matches := lineMatchPercent(jemsg, e.Message) // error message weight: 90% diff --git a/cmd/mcla_wasm/utils.go b/cmd/mcla_wasm/utils.go index f4ae8e7..91f7b27 100644 --- a/cmd/mcla_wasm/utils.go +++ b/cmd/mcla_wasm/utils.go @@ -32,10 +32,12 @@ func asJsValue(v any) (res js.Value) { } buf, err := json.Marshal(v) if err != nil { + fmt.Println("Error in asJsValue: json.Marshal:", err) panic(err) } var v1 any if err = json.Unmarshal(buf, &v1); err != nil { + fmt.Println("Error in asJsValue: json.Unmarshal:", err) panic(err) } return js.ValueOf(v1)