renamed renderError to handleError, fixed parameter order error