/// <summary> /// Invokes the OnPromiseError event. /// </summary> /// <param name="errorMessage"> The error message of the Promise. </param> protected void InternalInvokeError(string errorMessage) { if (finished) { return; } OnPromiseError?.Invoke(errorMessage); errorVal = errorMessage; }
/// <summary> /// Builds the current Promise which will eventually call the OnPromiseSuccess or OnPromiseError events. /// Pass the arguments which will be sent to the concrete Promise once the preliminary check for errors is successful. /// </summary> /// <typeparam name="T"> The return type of the UnityRequest. </typeparam> /// <param name="request"> The UnityRequest to check. </param> /// <param name="args"> The arguments to do a more in depth Promise check for success or error. </param> public void Build <T>(UnityRequest <T> request, params Func <object>[] args) { if (request.Exception == null && !EqualityComparer <T> .Default.Equals(request.Result, default(T))) { InternalBuild(args); } else { OnPromiseError?.Invoke(request.Exception.Message); } }