Bubble up error codes to devs (bug 846818)

This also cleans up the use of _error()
Merge pull request #293 from kumar303/errors

Bubble up error codes to devs (bug 846818)