SermoDigital/jose

Parsing token from a request masks errors

mvpmvh opened this issue · 1 comments

header.go never returns any unmarshaling errors if they were to occur.

// UnmarshalJSON implements json.Unmarshaler for Protected. func (p *Protected) UnmarshalJSON(b []byte) error { var h Header h.UnmarshalJSON(b) *p = Protected(h) return nil }

Does it not make sense to return any unmarshaling errors of the header?
// UnmarshalJSON implements json.Unmarshaler for Protected. func (p *Protected) UnmarshalJSON(b []byte) error { var h Header err := h.UnmarshalJSON(b); if err != nil { return err } *p = Protected(h) return nil }

Just glanced at it and I think you're correct. I'll go make the changes. Thank you!