Description
Status codes for errors in many apis is giving 400 (Bad Request). Here are the important ones:
- Backup Name conflict in the create backup api gives 400. (Should give 409)
- Restored index name conflict in the restore backup api gives 400. (Should give 409)
- Backup not found in the restore backup api gives 400. (Should give 404)
- Backup not found in the delete backup api gives 400. (Should give 404)
- Index not found in the vector operation (insert, get vector, update filter) api gives 400. (Should give 404)
Steps to Reproduce
- Hit APIs with conflicted names or backups/index that does not exist.
Cause
A lot of these checks are inside main.cpp and many others in the ndd.hpp. The error which are coming from ndd.hpp do not return a code. It just returns a pair with {success: bool, message: string}. Failure on these, just sends a 400 status code
Fixes and Discussion
- Should make a common exceptions and error handling util.
- Should move all the checks/validations to either
main.cpp or ndd.hpp.
- If all the validations move to
ndd.hpp, they should return the status codes too.
Description
Status codes for errors in many apis is giving 400 (Bad Request). Here are the important ones:
Steps to Reproduce
Cause
A lot of these checks are inside
main.cppand many others in thendd.hpp. The error which are coming fromndd.hppdo not return a code. It just returns a pair with{success: bool, message: string}. Failure on these, just sends a 400 status codeFixes and Discussion
main.cpporndd.hpp.ndd.hpp, they should return the status codes too.