Use typed error when SCIM bridge is not found

UpdateSCIMBridge returned bare fmt.Errorf("SCIM bridge not found")
strings on the two not-found branches (resource missing, and
cross-tenant mismatch). Every other call site returning the same
condition uses the typed NewSCIMBridgeNotFoundError(bridgeID) (see
lines 1962 and 2153 in this file).

Switch both branches to the typed error so the error shape is
consistent across the service and callers can use errors.As to
detect the condition.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-04-16 12:28:19 +02:00
committed by Sacha Al Himdani
parent 05e5187010
commit 0a5dfc652f

View File

@@ -1670,14 +1670,14 @@ func (s OrganizationService) UpdateSCIMBridge(
err := bridge.LoadByID(ctx, tx, scope, bridgeID)
if err != nil {
if err == coredata.ErrResourceNotFound {
return fmt.Errorf("SCIM bridge not found")
return NewSCIMBridgeNotFoundError(bridgeID)
}
return fmt.Errorf("cannot load SCIM bridge: %w", err)
}
if bridge.OrganizationID != organizationID {
return fmt.Errorf("SCIM bridge not found")
return NewSCIMBridgeNotFoundError(bridgeID)
}
bridge.ExcludedUserNames = excludedUserNames