Skip to content

Helia throws when adding a block if it is already pinned #642

@justin0mcateer

Description

@justin0mcateer

When adding content to Helia and setting the 'pin' option to true, if a pin exists the add method will throw a generic error with the message 'Already Pinned'.

The throw is here:
https://github.com/ipfs/helia/blob/main/packages/utils/src/pins.ts#L75

A couple of thoughts:

  1. If the content already exists and/or is already pinned, is this really an error? The goal of the client is to have the content pinned, if it is already pinned, the client desire is satisfied already, not unsatisfiable.
  2. If an error must be thrown, providing a specific error type or enumeration that could be reliably checked against would be helpful. Checking against an arbitrary message string seems fragile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood issue for new contributorshelp wantedSeeking public contribution on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions