Updated to throw exceptions in error method.