SetAlert sets alert in the given data for given error.
(err error, alertInYield bool)
| 73 | |
| 74 | // SetAlert sets alert in the given data for given error. |
| 75 | func (d *Data) SetAlert(err error, alertInYield bool) { |
| 76 | errC := errors.Cause(err) |
| 77 | |
| 78 | var alert Alert |
| 79 | if pErr, ok := errC.(PublicError); ok { |
| 80 | alert = Alert{ |
| 81 | Level: AlertLvlError, |
| 82 | Message: pErr.Public(), |
| 83 | } |
| 84 | } else { |
| 85 | alert = Alert{ |
| 86 | Level: AlertLvlError, |
| 87 | Message: AlertMsgGeneric, |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | d.PutAlert(alert, alertInYield) |
| 92 | } |
| 93 | |
| 94 | // AlertError returns a new error alert using the given message. |
| 95 | func (d *Data) AlertError(msg string) { |
no test coverage detected