MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / NotifyError

Function NotifyError

internal/notification/notification.go:118–147  ·  view source on GitHub ↗

NotifyError sends an error notification through the configured notification system. It logs the error locally and sends a notification via Slack (if configured). Parameters: - systemError: The error to notify. This function runs the notification process asynchronously using a goroutine to avoid bl

(systemError error)

Source from the content-addressed store, hash-verified

116//
117// This function runs the notification process asynchronously using a goroutine to avoid blocking.
118func NotifyError(systemError error) {
119 go func(systemError error) {
120 // Log the error locally using logrus
121 logrus.Error(systemError)
122
123 // Fetch the configuration
124 conf, err := config.Fetch()
125 if err != nil {
126 logrus.Error(err)
127 return
128 }
129
130 // If Slack is configured, send the error notification to Slack
131 if conf.Notification.Slack.WebhookUrl != "" {
132 SlackNotification(systemError)
133 }
134
135 // If a webhook sender is registered and webhook URL is configured, send the webhook
136 if webhookSender != nil && conf.Notification.Webhook.Url != "" {
137 payload := map[string]interface{}{
138 "error": systemError.Error(),
139 "time": time.Now(),
140 }
141 err := webhookSender("system.error", payload)
142 if err != nil {
143 logrus.Errorf("Error sending webhook notification: %v", err)
144 }
145 }
146 }(systemError)
147}

Callers 12

UpdateMetadataMethod · 0.92
postIdentityActionsMethod · 0.92
postLedgerActionsMethod · 0.92
checkBalanceMonitorsMethod · 0.92
postBalanceActionsMethod · 0.92
enqueueTransactionsFunction · 0.92
processLineageMethod · 0.92
ExecuteHooksMethod · 0.92
processTransactionMethod · 0.92
preRunFunction · 0.92

Calls 3

FetchFunction · 0.92
SlackNotificationFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected