tree-wide: panic when json marshalling fails
According to the new guidelines in docs/errors.md. Note that this does not include code that marshals to a writer that might fail (when a connection drops, for example).
This commit is contained in:
parent
ad1a12f7aa
commit
ee752b0ab8
4 changed files with 6 additions and 7 deletions
|
|
@ -43,13 +43,13 @@ type Group struct {
|
|||
func (b *Blueprint) DeepCopy() (Blueprint, error) {
|
||||
bpJSON, err := json.Marshal(b)
|
||||
if err != nil {
|
||||
return Blueprint{}, err
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var bp Blueprint
|
||||
err = json.Unmarshal(bpJSON, &bp)
|
||||
if err != nil {
|
||||
return Blueprint{}, err
|
||||
panic(err)
|
||||
}
|
||||
return bp, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,6 @@ func (s *Store) change(f func() error) error {
|
|||
if s.stateChannel != nil {
|
||||
serialized, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
// we ought to know all types that go into the store
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue