Implement an ok
boolean to signal whether an API request was successful.
#904
Labels
ok
boolean to signal whether an API request was successful.
#904
Currently the various
DwnApi
responses return aDwnResponseStatus
object which includes acode
and `detail.It would be helpful to follow a similar pattern as the
fetch
API to additionally return anok
boolean that determines if the request is considered successful or not. This reduces the overhead for developers to think about which status codes are relevant for which response, and only utilize those codes when they need to act on them.It's useful to understand the different codes that
dwn-sdk-js
throws for the various method handlers, for exampleRecordsWrite
can return:202
- Successful write.204
- Write was accepted, but no content is assigned to the record, a query/read would not return a result.409
- Conflict, a newer or equivalent record already exists, write failed.400
- Message validation error401
- Authorization errorI would expect that only a
202
of this list would be considered a successful result to the caller.The text was updated successfully, but these errors were encountered: