Add tests to cover env#error method