Switched to exception to expose the error message