Ignore no slack connector error during trust center access update

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-12-22 11:38:44 +01:00
parent cf491a2096
commit 504d31af6c
2 changed files with 13 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ package probo
import (
"context"
"errors"
"fmt"
"net/url"
"time"
@@ -26,6 +27,7 @@ import (
"go.probo.inc/probo/pkg/gid"
"go.probo.inc/probo/pkg/mail"
"go.probo.inc/probo/pkg/page"
"go.probo.inc/probo/pkg/slack"
"go.probo.inc/probo/pkg/statelesstoken"
"go.probo.inc/probo/pkg/validator"
)
@@ -365,7 +367,10 @@ func (s TrustCenterAccessService) Update(
if shouldUpdateSlackMessage {
if err := s.svc.SlackMessages.QueueSlackNotification(ctx, access.Email, access.TrustCenterID); err != nil {
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
var noConnectorErr slack.ErrNoSlackConnector
if !errors.Is(err, noConnectorErr) {
return nil, fmt.Errorf("cannot queue slack notification: %w", err)
}
}
}

View File

@@ -33,6 +33,12 @@ const (
slackMessageDeduplicationWindow = 7 * 24 * time.Hour
)
type ErrNoSlackConnector struct{}
func (e ErrNoSlackConnector) Error() string {
return "no slack connector found for organization"
}
type (
SlackMessageService struct {
svc *TenantService
@@ -208,7 +214,7 @@ func (s *SlackMessageService) QueueSlackNotification(
}
if !hasSlackConnector {
return fmt.Errorf("no slack connector found for organization")
return ErrNoSlackConnector{}
}
documents, reports, files, err := s.loadDocumentsReportsAndFilesFromAccesses(ctx, tx, trustCenterAccess.ID)