Skip to content

Commit

Permalink
Return Errors instead of Panicing (#30)
Browse files Browse the repository at this point in the history
* Return Errors instead of Panicing

- closes #28
- closes #4

Return errors and have the application decide how they want to handle panicing :smile

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* more error changes to prefix and mem dbs

* added errors to other dbs and tests pass

* linting and testing fixes

* add go mod verify to linting

* minor cleanup and changes added to cleveldb

* return error from Has()`

* address some PR comments

* some minor touch up on returning errors

* remvoe .vscode from .gitignore

* error: wraped some errors and comment

- add comment about why the error is ignored
- wraped a couple of errors with error.Wrap

* bring back expect in test case

* add error to iterator and reverse iterator

* add changelog entry
  • Loading branch information
tac0turtle committed Dec 11, 2019
1 parent 23d7625 commit 3abb245
Show file tree
Hide file tree
Showing 25 changed files with 1,045 additions and 534 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

/.vscode
.idea
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ linters-settings:
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## Unreleased

### BREAKING CHANGES

- [\#30](https://github.com/tendermint/tm-db/pull/30) Interface Breaking, Interfaces return errors instead of panic:
- Changes to function signatures:
- DB interface:
- `Get([]byte) ([]byte, error)`
- `Has(key []byte) (bool, error)`
- `Set([]byte, []byte) error`
- `SetSync([]byte, []byte) error`
- `Delete([]byte) error`
- `DeleteSync([]byte) error`
- `Iterator(start, end []byte) (Iterator, error)`
- `ReverseIterator(start, end []byte) (Iterator, error)`
- `Close() error`
- `Print() error`
- Batch interface:
- `Write() error`
- `WriteSync() error`
- Iterator interface:
- `Next() error`
- `Key() (key []byte, err error)`
- `Value() (value []byte, err error)`


### IMPROVEMENTS

## 0.3

**2019-11-18**
Expand Down
9 changes: 0 additions & 9 deletions CHANGELOG_PENDING.md

This file was deleted.

Loading

0 comments on commit 3abb245

Please sign in to comment.