class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externalizable {
    /** */
    private static final long serialVersionUID = 0L;

    /** */
    @GridToStringInclude(sensitive = true)
    private T res;

    /** */
    private Exception err;

    /**
     * Empty constructor required by {@link Externalizable}.
     */
    public CacheInvokeResult() {
        // No-op.
    }

    /**
     * Static constructor.
     *
     * @param res Computed result.
     * @return New instance.
     */
    public static <T> CacheInvokeResult<T> fromResult(T res) {
        CacheInvokeResult<T> cacheRes = new CacheInvokeResult<>();

        cacheRes.res = res;

        return cacheRes;
    }

    /**
     * @return Result.
     */
    public T result() {
        return res;
    }

    /**
     * Entry processor error;
     */
    public Exception error() {
        return err;
    }

    /**
     * Static constructor.
     *
     * @param err Exception thrown by {@link EntryProcessor#process(MutableEntry, Object...)}.
     * @return New instance.
     */
    public static <T> CacheInvokeResult<T> fromError(Exception err) {
        assert err != null;

        CacheInvokeResult<T> res = new CacheInvokeResult<>();

        res.err = err;

        return res;
    }

    /** {@inheritDoc} */
    @Override public T get() throws EntryProcessorException {<FILL_FUNCTION_BODY>}

    /** {@inheritDoc} */
    @Override public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject(res);

        out.writeObject(err);
    }

    /** {@inheritDoc} */
    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        res = (T)in.readObject();

        err = (Exception)in.readObject();
    }

    /** {@inheritDoc} */
    @Override public String toString() {
        return S.toString(CacheInvokeResult.class, this);
    }
}

        if (err != null) {
            if (err instanceof UnregisteredClassException || err instanceof UnregisteredBinaryTypeException)
                throw (IgniteException)err;

            if (err instanceof EntryProcessorException)
                throw (EntryProcessorException)err;

            throw new EntryProcessorException(err);
        }

        return res;
    
<no_super_class>