Added support for passing an error