]> Cypherpunks repositories - gostls13.git/commit
encoding/json: make error capture logic in recover more type safe
authorJoe Tsai <joetsai@digital-static.net>
Wed, 6 Dec 2017 06:53:48 +0000 (22:53 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Wed, 14 Feb 2018 21:34:26 +0000 (21:34 +0000)
commit91a6a2a30f95da8ae3fb6329a71c49ed13aa12ad
tree1924c3c82b14e38b9d9e22e2227d7661b8804a77
parent70a04f6880a2082a76f6282361b607f859db950f
encoding/json: make error capture logic in recover more type safe

Rather than only ignoring runtime.Error panics, which are a very
narrow set of possible panic values, switch it such that the json
package only captures panic values that have been properly wrapped
in a jsonError struct. This ensures that only intentional panics
originating from the json package are captured.

Fixes #23012

Change-Id: I5e85200259edd2abb1b0512ce6cc288849151a6d
Reviewed-on: https://go-review.googlesource.com/94019
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/encoding/json/decode.go
src/encoding/json/decode_test.go
src/encoding/json/encode.go
src/encoding/json/encode_test.go