Skip to content
This repository was archived by the owner on Sep 9, 2021. It is now read-only.
This repository was archived by the owner on Sep 9, 2021. It is now read-only.

Standardising on errors in implementations #23

Open
@vmx

Description

@vmx

I had another look at the block API rm tests to improve the error handling of the test.

Currently the error from the datastore implementations just bubble up. So in case of a block rm I got:

{ [Error: ENOENT: no such file or directory, unlink '/tmp/ipfs-test-72e2ac95f367457c10d27493ae180348/blocks/QP/CIQJUEPSMDQEKVS7XM6EVFOUIQK2QLXKMDQHGDQBQ7X76O23KCRWQPI.data']
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path:
   '/tmp/ipfs-test-72e2ac95f367457c10d27493ae180348/blocks/QP/CIQJUEPSMDQEKVS7XM6EVFOUIQK2QLXKMDQHGDQBQ7X76O23KCRWQPI.data' }

Which is very implementation specific. The error should rather be similar to Go-IPFS's HTTP Error:

"Error":"blockstore: block not found"

After reading ipfs/js-ipfs#1406 and ipfs/js-ipfs#1506 (comment) and seeing that there's already a file with errors using err-code, I think it would make sense to use those errors also in the implementations. We could then even have tests in this repo, testing for those errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions