Skip to content

Intuitive Error Handling #249

@pankajEndee

Description

@pankajEndee

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

  1. 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.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions