I don't think you should catch panic(string), issues 4222 and 4474 are programming errors in ...
12 years, 4 months ago
(2012-12-15 11:48:35 UTC)
#2
I don't think you should catch panic(string), issues 4222 and 4474 are
programming errors in the package and should not be turned into errors that lose
all the panic context.
Also, your new code loses the repanic on runtime.Error, and can lead to
inscrutable errors like "index out of range" that are totally unhelpful (lost
debugging abilities for stupid errors in user's UnmarshalJSON).
I think this is too broad a fix. Let's fix the (apparently few) panics taking ...
12 years, 4 months ago
(2012-12-17 00:50:57 UTC)
#3
I think this is too broad a fix. Let's fix the (apparently few) panics taking
strings instead of panicking for everything.
Note that the 'case error' in your switches covers case runtime.Error too, so
this is squelching runtime.Errors that used to be panics.
I only see one panic(" in the tree that isn't unreachable:
scanner.go:610: panic("json: invalid use of scanner")
The test cases in issues 4474 and 4222 are real bugs in the way json uses
reflect: it shouldn't be asking reflect to do those things. We should fix those
calls, not turn reflect's panics into returned errors.
Issue 6938045: code review 6938045: encoding/json: fix type assertion in error path
(Closed)
Created 12 years, 4 months ago by dave_cheney.net
Modified 12 years, 4 months ago
Reviewers: remyoudompheng, rsc
Base URL:
Comments: 0