rewrite error -> result