Error method completes the go error. Returns the "[Status] Title" string form of this Problem. If Problem is not a valid one, it returns "invalid problem".
()
| 213 | // Returns the "[Status] Title" string form of this Problem. |
| 214 | // If Problem is not a valid one, it returns "invalid problem". |
| 215 | func (p Problem) Error() string { |
| 216 | if !p.Validate() { |
| 217 | return "invalid problem" |
| 218 | } |
| 219 | |
| 220 | return fmt.Sprintf("[%d] %s", p["status"], p["title"]) |
| 221 | } |
| 222 | |
| 223 | // MarshalXML makes this Problem XML-compatible content to render. |
| 224 | func (p Problem) MarshalXML(e *xml.Encoder, start xml.StartElement) error { |