Class Error
Represents an error that occured when interacting with a Kafka broker or the librdkafka library.
Inheritance
Inherited Members
Namespace: Confluent.Kafka
Assembly: cs.temp.dll.dll
Syntax
public class Error
Constructors
Error(ErrorCode)
Initialize a new Error instance from a particular ErrorCode value.
Declaration
public Error(ErrorCode code)
Parameters
Type | Name | Description |
---|---|---|
ErrorCode | code | The ErrorCode value associated with this Error. |
Remarks
The reason string associated with this Error will be a static value associated with the ErrorCode.
Error(ErrorCode, String)
Initialize a new Error instance from a particular
ErrorCode value and custom reason
string.
Declaration
public Error(ErrorCode code, string reason)
Parameters
Type | Name | Description |
---|---|---|
ErrorCode | code | The ErrorCode value associated with this Error. |
System.String | reason | A custom reason string associated with the error
(overriding the static string associated with
|
Properties
Code
Gets the ErrorCode associated with this Error.
Declaration
public ErrorCode Code { get; }
Property Value
Type | Description |
---|---|
ErrorCode |
HasError
true if Code != ErrorCode.NoError.
Declaration
public bool HasError { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsBrokerError
true if this error originated on a broker, false otherwise.
Declaration
public bool IsBrokerError { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLocalError
true if this is error originated locally (within librdkafka), false otherwise.
Declaration
public bool IsLocalError { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Reason
Gets a human readable reason string associated with this error.
Declaration
public string Reason { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Equals(Object)
Tests whether this Error instance is equal to the specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The object to test. |
Returns
Type | Description |
---|---|
System.Boolean | true if obj is an Error and the Code property values are equal. false otherwise. |
Overrides
GetHashCode()
Returns a hash code for this Error value.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | An integer that specifies a hash value for this Error value. |
Overrides
ToString()
Returns the string representation of the error. Depending on error source this might be a rich contextual error message, or a simple static string representation of the error Code.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation of the Error object. |
Overrides
Operators
Equality(Error, Error)
Tests whether Error value a is equal to Error value b.
Declaration
public static bool operator ==(Error a, Error b)
Parameters
Type | Name | Description |
---|---|---|
Error | a | The first Error value to compare. |
Error | b | The second Error value to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if Error values a and b are equal. false otherwise. |
Implicit(Error to ErrorCode)
Converts the specified Error value to the value of it's Code property.
Declaration
public static implicit operator ErrorCode(Error e)
Parameters
Type | Name | Description |
---|---|---|
Error | e | The Error value to convert. |
Returns
Type | Description |
---|---|
ErrorCode |
Implicit(Error to Boolean)
Converts the specified Error value to a boolean value (false if e.Code == ErrorCode.NoError, true otherwise).
Declaration
public static implicit operator bool (Error e)
Parameters
Type | Name | Description |
---|---|---|
Error | e | The Error value to convert. |
Returns
Type | Description |
---|---|
System.Boolean |
Implicit(ErrorCode to Error)
Converts the specified ErrorCode value to it's corresponding rich Error value.
Declaration
public static implicit operator Error(ErrorCode c)
Parameters
Type | Name | Description |
---|---|---|
ErrorCode | c | The ErrorCode value to convert. |
Returns
Type | Description |
---|---|
Error |
Inequality(Error, Error)
Tests whether Error value a is not equal to Error value b.
Declaration
public static bool operator !=(Error a, Error b)
Parameters
Type | Name | Description |
---|---|---|
Error | a | The first Error value to compare. |
Error | b | The second Error value to compare. |
Returns
Type | Description |
---|---|
System.Boolean | true if Error values a and b are not equal. false otherwise. |