Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewAcceptPeginQuoteHandler(useCase *pegin.AcceptQuoteUseCase) http.HandlerF
acceptedQuote, err := useCase.Run(req.Context(), acceptRequest.QuoteHash)
if errors.Is(err, usecases.QuoteNotFoundError) ||
errors.Is(err, usecases.ExpiredQuoteError) {
jsonErr := rest.NewErrorResponseWithDetails("invalid request", rest.DetailsFromError(err), true)
rest.JsonErrorResponse(w, http.StatusBadRequest, jsonErr)
jsonErr := rest.NewErrorResponseWithDetails("quote not found", rest.DetailsFromError(err), true)
rest.JsonErrorResponse(w, http.StatusNotFound, jsonErr)
Copy link
Copy Markdown
Collaborator

@Luisfc68 Luisfc68 Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will return 404 also when the quote is expired, shouldn't that scenario maintain the 400?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree to differentiate the error code

return
} else if errors.Is(err, usecases.NoLiquidityError) {
jsonErr := rest.NewErrorResponseWithDetails("not enough liquidity", rest.DetailsFromError(err), true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewAcceptPegoutQuoteHandler(useCase *pegout.AcceptQuoteUseCase) http.Handle
acceptedQuote, err := useCase.Run(req.Context(), acceptRequest.QuoteHash)
if errors.Is(err, usecases.QuoteNotFoundError) ||
errors.Is(err, usecases.ExpiredQuoteError) {
jsonErr := rest.NewErrorResponseWithDetails("invalid request", rest.DetailsFromError(err), true)
rest.JsonErrorResponse(w, http.StatusBadRequest, jsonErr)
jsonErr := rest.NewErrorResponseWithDetails("invalid quote hash", rest.DetailsFromError(err), true)
rest.JsonErrorResponse(w, http.StatusNotFound, jsonErr)
return
} else if errors.Is(err, usecases.NoLiquidityError) {
jsonErr := rest.NewErrorResponseWithDetails("not enough liquidity", rest.DetailsFromError(err), true)
Expand Down
Loading