small refactoring.
error object added.