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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user