youtube_explode/lib/src/exceptions/video_unavailable_exception...

28 lines
1.2 KiB
Dart
Raw Normal View History

2020-06-03 23:02:21 +02:00
import '../videos/video_id.dart';
2020-05-31 23:36:23 +02:00
import 'exceptions.dart';
2020-02-23 21:00:35 +01:00
/// Thrown when a video is not available and cannot be processed.
/// This can happen because the video does not exist, is deleted,
/// is private, or due to other reasons.
2020-05-31 23:36:23 +02:00
class VideoUnavailableException implements VideoUnplayableException {
/// Description message
2020-06-05 16:17:08 +02:00
@override
2020-05-31 23:36:23 +02:00
final String message;
2020-02-23 21:00:35 +01:00
/// Initializes an instance of [VideoUnavailableException]
2020-05-31 23:36:23 +02:00
VideoUnavailableException(this.message);
2020-02-23 21:00:35 +01:00
2020-05-31 23:36:23 +02:00
/// Initializes an instance of [VideoUnplayableException] with a [VideoId]
VideoUnavailableException.unavailable(VideoId videoId)
: message = 'Video \'$videoId\' is unavailable\n'
'In most cases, this error indicates that the video doesn\'t exist, ' // ignore: lines_longer_than_80_chars
'is private, or has been taken down.\n'
'If you can however open this video in your browser in incognito mode, ' // ignore: lines_longer_than_80_chars
'it most likely means that YouTube changed something, which broke this library.\n' // ignore: lines_longer_than_80_chars
'Please report this issue on GitHub in that case.';
2020-12-30 15:00:11 +01:00
@override
2021-03-11 14:20:10 +01:00
String toString() =>
'$runtimeType: $message'; // ignore: no_runtimetype_tostring
2020-02-23 21:00:35 +01:00
}