Skip to content

Commit dd1dff6

Browse files
authored
Merge pull request #2322 from CortexFoundation/dev
improve error handling
2 parents 824c53e + 6473259 commit dd1dff6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

ctxcdb/remotedb/remotedb.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Database struct {
3434

3535
func (db *Database) Has(key []byte) (bool, error) {
3636
if _, err := db.Get(key); err != nil {
37-
return false, nil
37+
return false, err
3838
}
3939
return true, nil
4040
}
@@ -50,7 +50,7 @@ func (db *Database) Get(key []byte) ([]byte, error) {
5050

5151
func (db *Database) HasAncient(kind string, number uint64) (bool, error) {
5252
if _, err := db.Ancient(kind, number); err != nil {
53-
return false, nil
53+
return false, err
5454
}
5555
return true, nil
5656
}
@@ -152,7 +152,8 @@ func (db *Database) Close() error {
152152
}
153153

154154
func New(client *rpc.Client) ctxcdb.Database {
155-
return &Database{
156-
remote: client,
155+
if client == nil {
156+
return nil
157157
}
158+
return &Database{remote: client}
158159
}

0 commit comments

Comments
 (0)