FullError can be used when the hint and/or detail are to be tested.
(err error)
| 31 | |
| 32 | // FullError can be used when the hint and/or detail are to be tested. |
| 33 | func FullError(err error) string { |
| 34 | var errString string |
| 35 | if err == nil { |
| 36 | panic("FullError should not be called with nil input") |
| 37 | } |
| 38 | if pqErr := (*pq.Error)(nil); errors.As(err, &pqErr) { |
| 39 | errString = formatMsgHintDetail("pq", pqErr.Message, pqErr.Hint, pqErr.Detail) |
| 40 | } else { |
| 41 | pg := Flatten(err) |
| 42 | errString = formatMsgHintDetail(pg.Severity, err.Error(), pg.Hint, pg.Detail) |
| 43 | } |
| 44 | return errString |
| 45 | } |
| 46 | |
| 47 | func formatMsgHintDetail(prefix, msg, hint, detail string) string { |
| 48 | var b strings.Builder |
no test coverage detected
searching dependent graphs…