youtube_explode/lib/src/exceptions/transient_failure_exception...

27 lines
948 B
Dart
Raw Normal View History

2020-05-31 23:36:23 +02:00
import 'package:http/http.dart';
import 'youtube_explode_exception.dart';
/// Exception thrown when a fatal failure occurs.
class TransientFailureException implements YoutubeExplodeException {
2020-06-05 16:17:08 +02:00
@override
2020-05-31 23:36:23 +02:00
final String message;
/// Initializes an instance of [TransientFailureException]
TransientFailureException(this.message);
/// Initializes an instance of [TransientFailureException] with a [Response]
2020-06-03 23:02:21 +02:00
TransientFailureException.httpRequest(BaseResponse response)
2020-05-31 23:36:23 +02:00
: message = '''
Failed to perform an HTTP request to YouTube due to a transient failure.
In most cases, this error indicates that the problem is on YouTube's side and this is not a bug in the library.
To resolve this error, please wait some time and try again.
If this issue persists, please report it on the project's GitHub page.
Request: ${response.request}
Response: $response
''';
@override
String toString() => 'TransientFailureException: $message';
}