cancelCustomJob method

  1. @override
Future<void> cancelCustomJob(
  1. CancelCustomJobRequest request
)
override

Cancels a CustomJob. Starts asynchronous cancellation on the CustomJob. The server makes a best effort to cancel the job, but success is not guaranteed. Clients can use JobService.GetCustomJob or other methods to check whether the cancellation succeeded or whether the job completed despite cancellation. On successful cancellation, the CustomJob is not deleted; instead it becomes a job with a CustomJob.error value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED, and CustomJob.state is set to CANCELLED.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Future<void> cancelCustomJob(CancelCustomJobRequest request) async {
  if (isClosed) throw StateError('Service is closed');

  if (_cancelCustomJob case final cancelCustomJob?) {
    return cancelCustomJob(request);
  }
  throw UnsupportedError('cancelCustomJob');
}