Feature/189 use new error object

Fixes #188 and #189.