dby icon indicating copy to clipboard operation
dby copied to clipboard

Improve error handling

Open Klaus-Tockloth opened this issue 2 years ago • 1 comments

v, err := state.GetPath(key)
if err != nil {
	log.Fatalf("error [%v] at state.GetPath()", err)
}

Error message if the 'key" doesn't exists:

2022/11/03 11:48:12.922025 main.go:124: error [github.com/ulfox/dby/db.(*Storage).GetPath#163
: github.com/ulfox/dby/db.(*SQL).getPath#154
: the given key [MissingKey] does not exist] at state.GetPath()

The error message is difficult to handle because the error cause 'does not exist' is not wrapped. So it's difficult to distinguish 'does not exist' from any other possible error.

Klaus-Tockloth avatar Nov 03 '22 12:11 Klaus-Tockloth

Yea, makes sense, it is confusing right now. I will have a look on this when I find some time after work

ulfox avatar Nov 15 '22 12:11 ulfox