djeck1432 / spotnet

0 stars 6 forks source link

Fix/api error handling #56

Closed Kostya-59benz closed 7 hours ago

Kostya-59benz commented 3 days ago

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

  1. (/api/get-user-contract) Try to get user contract for an existing user - a successful response is expected.
  2. (/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.
  3. (api/get-repay-data) Try to get repay_data for an existing wallet_id - a successful response is expected.
  4. (api/get-repay-data) Try to get repay_data for a non existing wallet_id - a 404 error with a corresponding message is expected.
  5. (/api/close-position) Try to get position_status for an existing position_id - a successful response is expected.
  6. (/api/close-position) Try to get position_status for a non existing position_id - a 404 error with a corresponding message is expected.
  7. (/api/open-position) Try to get position_status for an existing position_id - a successful response is expected.
  8. (/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.