MCPcopy Index your code
hub / github.com/dnote/dnote / SetAlert

Method SetAlert

pkg/server/views/data.go:75–92  ·  view source on GitHub ↗

SetAlert sets alert in the given data for given error.

(err error, alertInYield bool)

Source from the content-addressed store, hash-verified

73
74// SetAlert sets alert in the given data for given error.
75func (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.
95func (d *Data) AlertError(msg string) {

Callers 1

handleHTMLErrorFunction · 0.80

Calls 2

PutAlertMethod · 0.95
PublicMethod · 0.65

Tested by

no test coverage detected