/// <summary> /// Report an initialization error as an asynchronous operation. /// </summary> /// <param name="exception">The exception to report.</param> /// <param name="cancellationToken">The optional cancellation token to use.</param> /// <returns>A Task representing the asynchronous operation.</returns> public Task ReportInitializationErrorAsync(Exception exception, CancellationToken cancellationToken = default) { if (exception == null) { throw new ArgumentNullException(nameof(exception)); } return(_internalClient.ErrorAsync(null, LambdaJsonExceptionWriter.WriteJson(ExceptionInfo.GetExceptionInfo(exception)), cancellationToken)); }
/// <summary> /// Report an invocation error as an asynchronous operation. /// </summary> /// <param name="awsRequestId">The ID of the function request that caused the error.</param> /// <param name="exception">The exception to report.</param> /// <param name="cancellationToken">The optional cancellation token to use.</param> /// <returns>A Task representing the asynchronous operation.</returns> public Task ReportInvocationErrorAsync(string awsRequestId, Exception exception, CancellationToken cancellationToken = default) { if (awsRequestId == null) { throw new ArgumentNullException(nameof(awsRequestId)); } if (exception == null) { throw new ArgumentNullException(nameof(exception)); } var exceptionInfo = ExceptionInfo.GetExceptionInfo(exception); var exceptionInfoJson = LambdaJsonExceptionWriter.WriteJson(exceptionInfo); var exceptionInfoXRayJson = LambdaXRayExceptionWriter.WriteJson(exceptionInfo); return(_internalClient.ErrorWithXRayCauseAsync(awsRequestId, exceptionInfo.ErrorType, exceptionInfoJson, exceptionInfoXRayJson, cancellationToken)); }
/// <summary> /// Report an invocation error as an asynchronous operation. /// </summary> /// <param name="awsRequestId">The ID of the function request that caused the error.</param> /// <param name="exception">The exception to report.</param> /// <returns>A Task representing the asynchronous operation.</returns> public Task ReportInvocationErrorAsync(string awsRequestId, Exception exception) { if (awsRequestId == null) { throw new ArgumentNullException(nameof(awsRequestId)); } if (exception == null) { throw new ArgumentNullException(nameof(exception)); } var exceptionInfo = ExceptionInfo.GetExceptionInfo(exception); return(_internalClient.Error2Async(awsRequestId, exceptionInfo.ErrorType, LambdaJsonExceptionWriter.WriteJson(exceptionInfo))); }