ApiException class
Exception thrown when an API request fails.
This exception is thrown by MailValidationClient methods when:
- The API returns an error response
- Network errors occur
- Authentication fails
- Rate limits are exceeded
Example:
try {
await client.validateEmail('test@example.com');
} on ApiException catch (e) {
if (e.statusCode == 401) {
print('Invalid API key');
} else if (e.statusCode == 402) {
print('Insufficient credits');
} else {
print('Error: ${e.message}');
}
}
- Implemented types
Constructors
- ApiException({required String message, String? code, int? statusCode})
-
Creates a new ApiException.
const
Properties
- code → String?
-
An optional error code from the API.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The error message describing what went wrong.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statusCode → int?
-
The HTTP status code of the error response, if available.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited