SmartUploadException class
The single exception type thrown by flutter_smart_upload.
try {
await task.done;
} on SmartUploadException catch (e) {
if (e.isRetryable) scheduleAnotherAttempt();
print('${e.code}: ${e.message}');
}
- Implemented types
Constructors
- SmartUploadException(String message, {UploadErrorCode errorCode = UploadErrorCode.unknown, Object? cause, StackTrace? stackTrace, bool? retryable})
-
Creates an exception with an explicit
errorCode. - SmartUploadException.authentication(String message, {Object? cause})
- Credentials were rejected. Never retried automatically.
- SmartUploadException.cancelled([String message = 'Upload was cancelled'])
- The upload was cancelled by the caller.
- SmartUploadException.compression(String message, {Object? cause})
- Compression or resizing failed.
- SmartUploadException.fileNotFound(String path)
- The source file could not be found.
- SmartUploadException.invalidFile(String message, {Object? cause})
- The source file is present but unusable.
- SmartUploadException.network(String message, {Object? cause})
- A transport failure. Retryable by default.
- SmartUploadException.server(String message, {Object? cause})
- The remote end failed. Retryable by default.
- SmartUploadException.timeout(String message, {Object? cause})
- A deadline was exceeded. Retryable by default.
Properties
- cause → Object?
-
The underlying error, when this exception wraps another failure.
final
- code → String
-
The stable string form of errorCode, e.g.
network_error.no setter - errorCode → UploadErrorCode
-
The typed error code.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRetryable → bool
-
Whether retrying this operation could plausibly succeed.
no setter
- message → String
-
A human readable description of what went wrong.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace of cause, when available.
final
Methods
-
asRetryable(
{bool retryable = true}) → SmartUploadException -
Returns a copy of this exception with
retryableoverridden. -
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
Static Methods
-
wrap(
Object error, [StackTrace? stackTrace, UploadErrorCode fallback = UploadErrorCode.unknown]) → SmartUploadException -
Wraps an arbitrary
errorinto a SmartUploadException.