Closed tailhook closed 6 years ago
I assumed the result should be NaN or error or undefined, but certainly not crash:
main = 1/0
> sentinel apply test.sentinel panic: runtime error: integer divide by zero [recovered] panic: runtime error: integer divide by zero goroutine 1 [running]: github.com/hashicorp/sentinel/runtime/eval.(*evalState).recoverBailout(0xc42018a6e0, 0xc42016b7a0, 0xc42016b7a8) /go/src/github.com/hashicorp/sentinel/runtime/eval/eval.go:171 +0xa7 panic(0x923620, 0xcccfe0) /usr/local/go/src/runtime/panic.go:491 +0x283 github.com/hashicorp/sentinel/runtime/eval.(*evalState).evalMathExpr_int(0xc42018a6e0, 0xc42016c380, 0xc42016e280, 0x1, 0x0, 0xc420170210, 0x0) /go/src/github.com/hashicorp/sentinel/runtime/eval/eval.go:1051 +0x20d [ .. snip .. ] > sentinel version Sentinel Simulator v0.1.0
Good catch, the spec has this correct but our implementation was wrong. Fixed now.
I assumed the result should be NaN or error or undefined, but certainly not crash: