Fix DB API

no ref
- Use correct error type
Merge pull request #4204 from halfdan/fix-db-api

Fix DB API