|
| 1 | +// Copyright 2021 Confluent Inc. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | +// |
| 15 | +// Refer to LICENSE for more information. |
| 16 | + |
| 17 | +using System; |
| 18 | +using System.Linq; |
| 19 | +using System.Collections.Generic; |
| 20 | + |
| 21 | + |
| 22 | +namespace Confluent.Kafka.Admin |
| 23 | +{ |
| 24 | + /// <summary> |
| 25 | + /// Represents an error that occured during a delete records request. |
| 26 | + /// </summary> |
| 27 | + public class DeleteRecordsException : KafkaException |
| 28 | + { |
| 29 | + /// <summary> |
| 30 | + /// Initializes a new DeleteRecordsException. |
| 31 | + /// </summary> |
| 32 | + /// <param name="results"> |
| 33 | + /// The result corresponding to all topic partitions in the request |
| 34 | + /// (whether or not they were in error). At least one of these |
| 35 | + /// results will be in error. |
| 36 | + /// </param> |
| 37 | + public DeleteRecordsException(List<DeleteRecordsReport> results) |
| 38 | + : base(new Error(ErrorCode.Local_Partial, |
| 39 | + "An error occurred deleting records: [" + |
| 40 | + String.Join(", ", results.Where(r => r.Error.IsError).Select(r => r.Topic)) + |
| 41 | + "]: [" + String.Join(", ", results.Where(r => r.Error.IsError).Select(r => r.Error)) + |
| 42 | + "].")) |
| 43 | + { |
| 44 | + Results = results; |
| 45 | + } |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// The result corresponding to all topics partitions in the request |
| 49 | + /// (whether or not they were in error). At least one of these |
| 50 | + /// results will be in error. |
| 51 | + /// </summary> |
| 52 | + public List<DeleteRecordsReport> Results { get; } |
| 53 | + } |
| 54 | +} |
0 commit comments