Currently the various DwnApi responses return a DwnResponseStatus object which includes a code and `detail.
It would be helpful to follow a similar pattern as the fetch API to additionally return an ok 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 example RecordsWrite 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 error
401 - Authorization error
I would expect that only a 202 of this list would be considered a successful result to the caller.
Currently the various
DwnApiresponses return aDwnResponseStatusobject which includes acodeand `detail.It would be helpful to follow a similar pattern as the
fetchAPI to additionally return anokboolean 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-jsthrows for the various method handlers, for exampleRecordsWritecan 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
202of this list would be considered a successful result to the caller.