Skip to content

Commit

Permalink
chore: check for deadline exceeded error
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed May 31, 2024
1 parent df7ec6b commit d31875e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,14 @@ func (svc *Service) NIP47Handler(c echo.Context) error {
"walletPubkey": requestData.WalletPubkey,
"relayUrl": requestData.RelayUrl,
}).Info("Stopped subscription without receiving event")
return c.JSON(http.StatusRequestTimeout, ErrorResponse{
Message: "Request canceled or timed out",
if ctx.Err() == context.DeadlineExceeded {
return c.JSON(http.StatusGatewayTimeout, ErrorResponse{
Message: "Request timed out",
Error: ctx.Err().Error(),
})
}
return c.JSON(http.StatusInternalServerError, ErrorResponse{
Message: "Context cancelled",
Error: ctx.Err().Error(),
})
case event := <-subscription.EventChan:
Expand Down

0 comments on commit d31875e

Please sign in to comment.