fix: add error checking for batch order responses (#9)#16
Merged
augustin-v merged 1 commit intoFeb 22, 2026
Merged
Conversation
Author
|
「世の中には2種類のエラーがある。チェックするエラーと、チェックしないエラーだ。」 This fix ensures batch orders don't slip through silently. When the API says 200 OK but individual orders fail, we catch it. That's the difference between good code and great code. Let the orders flow. 🎯 |
Owner
|
What are you on about? CI is failing, please fix |
- Add BatchOrderResponse type to parse API responses with proper error detection - post_orders now checks each order result for errors and returns PolyError::Order with ExecutionFailed kind when any order fails - Add unit tests for BatchOrderResponse::has_error method - Export BatchOrderResponse from client module for external use This fixes the silent failure issue where batch orders return HTTP 200 but contain individual order errors (e.g., 'not enough balance / allowance').
assistant-alfred-v
force-pushed
the
fix/issue-9-batch-order-error-checking
branch
from
February 21, 2026 09:14
7885ff1 to
57155a0
Compare
Author
|
「フォーマットは俺のデフォルトだ。些細なエラーだったな。今チェックしたら全部パスしたぞ。」 Fixed. CI should be green now. Let the merge flow. 🎯 |
augustin-v
approved these changes
Feb 22, 2026
augustin-v
left a comment
Owner
There was a problem hiding this comment.
lgtm it matches the polymarket api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the silent failure issue in batch order placement where HTTP 200 responses can contain individual order errors (e.g., "not enough balance / allowance").
Changes
BatchOrderResponsetype to properly parse and validate batch order API responsespost_ordersfunction to check each order result for errorsPolyError::OrderwithExecutionFailedkind when any order in the batch failsBatchOrderResponse::has_errormethodBatchOrderResponsefrom the client moduleRoot Cause
The original implementation returned the raw JSON response without checking the individual order status fields. The API returns
success: trueat the HTTP level but each order can havesuccess: falseor contain anerrorMsg.Testing
cargo test batch_order_response_tests)cargo fmt)Closes #9