MCPcopy
hub / github.com/safing/portmaster / updateStatesAndNotifyError

Method updateStatesAndNotifyError

service/control/pause.go:267–286  ·  view source on GitHub ↗

updateStatesAndNotifyError updates the paused states and sends an error notification. No thread safety, caller must hold c.locker.

(errDescription string, err error)

Source from the content-addressed store, hash-verified

265// updateStatesAndNotifyError updates the paused states and sends an error notification.
266// No thread safety, caller must hold c.locker.
267func (c *Control) updateStatesAndNotifyError(errDescription string, err error) {
268 if err == nil {
269 return
270 }
271
272 if errDescription == "" {
273 errDescription = "Error"
274 }
275
276 // Error notification
277 c.pauseNotification = &notifications.Notification{
278 EventID: "control:error",
279 Type: notifications.Error,
280 Title: errDescription,
281 Message: err.Error(),
282 EventData: &c.pauseInfo,
283 }
284 notifications.Notify(c.pauseNotification)
285 c.pauseNotification.SyncWithState(c.states)
286}
287
288func (c *Control) showNotification(title, message string) *notifications.Notification {
289 n := &notifications.Notification{

Callers 1

resumeMethod · 0.95

Calls 3

NotifyFunction · 0.92
SyncWithStateMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected