storj / uplink

Storj network Go library
MIT License
122 stars 17 forks source link

Verify which errors we should expose in API in first place #72

Open mniewrzal opened 2 years ago

mniewrzal commented 2 years ago

Gateway is getting a lot of errors from uplink that have no corresponding type. It's hard to map them without it. This is just list I quickly collected as a starting point. We should figure out which errors we should handle better in the first place.

uplink: stream: metaclient: metabase: pending object missing
uplink: metainfo: invalid direction 0
uplink: metaclient: metabase: conflict: object already exists
uplink: stream: metaclient: object not found: metabase: object with specified version and pending status is missing
uplink: stream: metaclient: signature verification: signature is not valid
uplink: stream: metaclient: eestream: requires 1 <= k <= n <= 256
uplink: stream: ecclient: successful puts (79) less than success threshold (80)
uplink: stream: ecclient: successful puts (1) less than or equal to repair threshold (35)
uplink: object not found: segment not found: segment missing
uplink: missing encryption base: "minisolong"/"store-entrance.mp4"
uplink: bucket: metaclient: cannot delete the bucket because it's being used by another process
uplink: stream: metaclient: metabase: unable to insert segment: ERROR: result is ambiguous (error=rpc error: code = Unavailable desc = transport is closing [exhausted]) (SQLSTATE 40003)
uplink: metainfo: metaclient: ERROR: no inbound stream connection (SQLSTATE XXUUU)
uplink: metaclient: metainfo: bucket name must contain only lowercase letters, numbers or hyphens
uplink: metaclient: metabase: size of part number 3 is below minimum threshold, got: 100.0 KiB, min: 5.0 MiB
mniewrzal commented 2 years ago

I think the easiest would be to map: uplink: stream: metaclient: metabase: pending object missing uplink: metaclient: metabase: conflict: object already exists

For first maybe we can reuse already existing uplink.ErrObjectNotFound for second we will create something new like uplink.ErrObjectAlreadyExists