Adding error handling when updating a user and contract
Change description
Added error handling for the case when the user is not found.
Added error handling for the case if the contract is not deployed.
Added error handling for the case when the wallet_id is not found.
Added error handling for the case when the position_id is not found.
Why
Previously, if the something required in parameters in function does not exist, None was returned or 0, which could confuse API users. This is now handled correctly, which improves the UX and makes debugging easier.
How test
(/api/get-user-contract) Try to get user contract for an existing user - a successful response is expected.
(/api/get-user-contract) Try to get user contract for a non-existent user or user_contract_not_deployed - a 404 error with a corresponding message is expected.
(api/get-repay-data) Try to get repay_data for an existing wallet_id - a successful response is expected.
(api/get-repay-data) Try to get repay_data for a non existing wallet_id - a 404 error with a corresponding message is expected.
(/api/close-position) Try to get position_status for an existing position_id - a successful response is expected.
(/api/close-position) Try to get position_status for a non existing position_id - a 404 error with a corresponding message is expected.
(/api/open-position) Try to get position_status for an existing position_id - a successful response is expected.
(/api/open-position) Try to get position_status for a non existing position_id - a 404 error with a corresponding message is expected.
Notes
Please check that your tests are up to date and running successfully.
Header
Adding error handling when updating a user and contract
Change description
Why
Previously, if the something required in parameters in function does not exist,
None
was returned or 0, which could confuse API users. This is now handled correctly, which improves the UX and makes debugging easier.How test
Notes
Please check that your tests are up to date and running successfully.