Address code review feedback

- Return 400 instead of panicking on invalid organization_id
- Use generic error message for internal failures
- Drop duplicate validation from initiate handler (kept in tx)
- Make preserveConnectionFields mutate in place
- Remove as type assertions in GoogleWorkspaceConnector
- Use sort.Slice instead of sort.SliceStable
- Consistent error prefixes in Slack sender

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-13 18:36:50 +02:00
parent 72478ef6e6
commit 05781d1bbd
5 changed files with 17 additions and 62 deletions

View File

@@ -160,7 +160,7 @@ func (s *Sender) sendMessage(ctx context.Context, tx pg.Querier, message *coreda
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, nil, fmt.Errorf("cannot send slack message: no connector configured for organization")
}
return nil, nil, fmt.Errorf("cannot load slack connector: %w", err)
return nil, nil, fmt.Errorf("cannot send slack message: %w", err)
}
if c.Connection == nil {
@@ -284,7 +284,7 @@ func (s *Sender) updateMessage(ctx context.Context, tx pg.Querier, updateMessage
if errors.Is(err, coredata.ErrResourceNotFound) {
return fmt.Errorf("cannot update slack message: no connector configured for organization")
}
return fmt.Errorf("cannot load slack connector: %w", err)
return fmt.Errorf("cannot update slack message: %w", err)
}
if c.Connection == nil {