convert error fromating to %w everywhere (#6995)

This commit is contained in:
Chris Lu
2025-07-16 23:39:27 -07:00
committed by GitHub
parent a524b4f485
commit 69553e5ba6
174 changed files with 524 additions and 524 deletions

View File

@@ -32,7 +32,7 @@ func (h *httpClient) sendMessage(message *webhookMessage) error {
// Serialize the protobuf message to JSON for HTTP payload
notificationData, err := json.Marshal(message.Notification)
if err != nil {
return fmt.Errorf("failed to marshal notification: %v", err)
return fmt.Errorf("failed to marshal notification: %w", err)
}
payload := map[string]interface{}{
@@ -43,12 +43,12 @@ func (h *httpClient) sendMessage(message *webhookMessage) error {
jsonData, err := json.Marshal(payload)
if err != nil {
return fmt.Errorf("failed to marshal message: %v", err)
return fmt.Errorf("failed to marshal message: %w", err)
}
req, err := http.NewRequest(http.MethodPost, h.endpoint, bytes.NewBuffer(jsonData))
if err != nil {
return fmt.Errorf("failed to create request: %v", err)
return fmt.Errorf("failed to create request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
@@ -68,7 +68,7 @@ func (h *httpClient) sendMessage(message *webhookMessage) error {
glog.Errorf("failed to drain response: %v", err)
}
return fmt.Errorf("failed to send request: %v", err)
return fmt.Errorf("failed to send request: %w", err)
}
defer resp.Body.Close()

View File

@@ -120,7 +120,7 @@ func (w *Queue) setupWatermillQueue(cfg *config) error {
logger,
)
if err != nil {
return fmt.Errorf("failed to create router: %v", err)
return fmt.Errorf("failed to create router: %w", err)
}
w.router = router
@@ -135,7 +135,7 @@ func (w *Queue) setupWatermillQueue(cfg *config) error {
poisonQueue, err := middleware.PoisonQueue(w.queueChannel, deadLetterTopic)
if err != nil {
return fmt.Errorf("failed to create poison queue: %v", err)
return fmt.Errorf("failed to create poison queue: %w", err)
}
router.AddPlugin(plugin.SignalsHandler)