The txn framework now returns detailed error to the client i.e which step
failed on which peer and with what error.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
...as 0 can indicate success.
* Added a comment with usage example for SendHTTPError()
* Handled case of passing nil:
SendHTTPError(ctx, http.StatusBadRequest, nil, api.SomeErrorCode)
Signed-off-by: Prashanth Pai <ppai@redhat.com>
* Remove having to specify default error code. It is made implicit
instead. This removes some of the code clutter.
* Support returning multiple errors in a single API response.
Although this will be rarely used, introducing the provision in API
right now is better than later.
* Allow callers to pass both string and error types.
* Introduce a error code map which maps error codes (integers) to their
brief textual description.
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Added extra argument to SendHTTPError function and added default error
code in all places.
To add a new error code, add entry in `pkg/api/errors.go` and then use
while calling SendHTTPError
Updates: #419
Signed-off-by: Aravinda VK <mail@aravindavk.in>