Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit 7aa0029

Browse files
committed
chore: rename abyfyIpldErrNotFound to parseIPLDErrNotFound
1 parent 4f5f8e9 commit 7aa0029

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

block.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (api *BlockAPI) Get(ctx context.Context, p path.Path) (io.Reader, error) {
6666
return nil, err
6767
}
6868
if resp.Error != nil {
69-
return nil, abyfyIpldNotFoundFallbackToError(resp.Error)
69+
return nil, parseIPLDNotFoundWithFallbackToError(resp.Error)
7070
}
7171

7272
//TODO: make get return ReadCloser to avoid copying
@@ -98,14 +98,14 @@ func (api *BlockAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.BlockRm
9898
return err
9999
}
100100

101-
return abyfyIpldNotFoundFallbackToMSG(removedBlock.Error)
101+
return parseIPLDNotFoundWithFallbackToMSG(removedBlock.Error)
102102
}
103103

104104
func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (iface.BlockStat, error) {
105105
var out blockStat
106106
err := api.core().Request("block/stat", p.String()).Exec(ctx, &out)
107107
if err != nil {
108-
return nil, abyfyIpldNotFoundFallbackToError(err)
108+
return nil, parseIPLDNotFoundWithFallbackToError(err)
109109
}
110110
out.cid, err = cid.Parse(out.Key)
111111
if err != nil {

abyfy_errors.go renamed to errors.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ func (e prePostWrappedNotFoundError) Unwrap() error {
2727
return e.wrapped
2828
}
2929

30-
func abyfyIpldNotFoundFallbackToMSG(msg string) error {
31-
err, handled := abyfyIpldNotFound(msg)
30+
func parseIPLDNotFoundWithFallbackToMSG(msg string) error {
31+
err, handled := parseIPLDNotFound(msg)
3232
if handled {
3333
return err
3434
}
3535

3636
return errors.New(msg)
3737
}
3838

39-
func abyfyIpldNotFoundFallbackToError(msg error) error {
40-
err, handled := abyfyIpldNotFound(msg.Error())
39+
func parseIPLDNotFoundWithFallbackToError(msg error) error {
40+
err, handled := parseIPLDNotFound(msg.Error())
4141
if handled {
4242
return err
4343
}
@@ -47,7 +47,7 @@ func abyfyIpldNotFoundFallbackToError(msg error) error {
4747

4848
// This file handle parsing and returning the correct ABI based errors from error messages
4949
//lint:ignore ST1008 this function is not using the error as a mean to return failure but it massages it to return the correct type
50-
func abyfyIpldNotFound(msg string) (error, bool) {
50+
func parseIPLDNotFound(msg string) (error, bool) {
5151
if msg == "" {
5252
return nil, true // Fast path
5353
}

abyfy_errors_test.go renamed to errors_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212

1313
var randomSha256MH = mh.Multihash{0x12, 0x20, 0x88, 0x82, 0x73, 0x37, 0x7c, 0xc1, 0xc9, 0x96, 0xad, 0xee, 0xd, 0x26, 0x84, 0x2, 0xc9, 0xc9, 0x5c, 0xf9, 0x5c, 0x4d, 0x9b, 0xc3, 0x3f, 0xfb, 0x4a, 0xd8, 0xaf, 0x28, 0x6b, 0xca, 0x1a, 0xf2}
1414

15-
func doAbyfyIpldNotFoundTest(t *testing.T, original error) {
15+
func doParseIpldNotFoundTest(t *testing.T, original error) {
1616
originalMsg := original.Error()
1717

18-
rebuilt := abyfyIpldNotFoundFallbackToMSG(originalMsg)
18+
rebuilt := parseIPLDNotFoundWithFallbackToMSG(originalMsg)
1919

2020
rebuiltMsg := rebuilt.Error()
2121

@@ -30,8 +30,8 @@ func doAbyfyIpldNotFoundTest(t *testing.T, original error) {
3030
}
3131
}
3232

33-
func TestAbyfyIpldNotFound(t *testing.T) {
34-
if err := abyfyIpldNotFoundFallbackToMSG(""); err != nil {
33+
func TestParseIPLDNotFound(t *testing.T) {
34+
if err := parseIPLDNotFoundWithFallbackToMSG(""); err != nil {
3535
t.Errorf("expected empty string to give no error; got %T %q", err, err.Error())
3636
}
3737

@@ -54,7 +54,7 @@ func TestAbyfyIpldNotFound(t *testing.T) {
5454
err = fmt.Errorf(wrap, err)
5555
}
5656

57-
doAbyfyIpldNotFoundTest(t, err)
57+
doParseIpldNotFoundTest(t, err)
5858
}
5959
}
6060
}

0 commit comments

Comments
 (0)