End the task/future with a return value, passing a ValueResult to cleanup callbacks and listeners. (Throws an error if the task is already ended or is currently cleaning up.) Provides the same execution and ordering guarantees as .end().
End the task/future with a thrown error, passing an ErrorResult to cleanup callbacks and listeners. (Throws an error if the task is already ended or is currently cleaning up.) Provides the same execution and ordering guarantees as .end().
Note: since this immediately ends the task with an error, it should only be called when the work of the task as a whole is no longer able to continue. If you want to notify a task about an error in a different task, you may want to use .asyncThrow() instead.
Interface for completing a Future or Task with a return value or error.