Expose error code in error object