mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
fix: ignore 404 when deleting an already-deleted lightning address (#2323) When a sub-wallet's lightning address was already removed on getalby.com, the DELETE call returns 404, which surfaced as a "Failed to delete lightning address" error toast. Treat 404 as success so deletion is idempotent.
This commit is contained in:
parent
5c23375c08
commit
d2acf9ccb1
1 changed files with 7 additions and 0 deletions
|
|
@ -418,6 +418,13 @@ func (svc *albyOAuthService) DeleteLightningAddress(ctx context.Context, address
|
|||
return errors.New("failed to read response body")
|
||||
}
|
||||
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
// The lightning address was already deleted on the Alby account
|
||||
// (e.g. removed previously). Treat as success so deletion is idempotent.
|
||||
logger.Logger.WithField("address", address).Info("Lightning address already deleted on Alby account, ignoring 404")
|
||||
return nil
|
||||
}
|
||||
|
||||
if res.StatusCode >= 300 {
|
||||
return fmt.Errorf("DELETE request to /internal/lightning_addresses/%s returned non-success status: %d %s", address, res.StatusCode, string(responseBody))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue