Replace the per-tracker json_serializable session classes and account stores with a shared TrackerSession (service-aware persisted validation), a single TrackerAccountStore, a shared TrackerHttpClient, and an AnimeListTrackerBase mixin for MAL/AniList. Scope the per-service rebind guard so a disconnect can't abort a racing profile load. Add migration-safety, MAL refresh, episode-count cache, and content-type tests.
35 lines
1.0 KiB
Dart
35 lines
1.0 KiB
Dart
import 'tracker_constants.dart';
|
|
|
|
class TrackerApiException implements Exception {
|
|
final TrackerService service;
|
|
final int statusCode;
|
|
final String body;
|
|
|
|
const TrackerApiException({required this.service, required this.statusCode, required this.body});
|
|
|
|
@override
|
|
String toString() => 'TrackerApiException(${service.name}, HTTP $statusCode): $body';
|
|
}
|
|
|
|
class TrackerAuthException implements Exception {
|
|
final TrackerService service;
|
|
final String message;
|
|
final int? statusCode;
|
|
final bool isPermanent;
|
|
|
|
const TrackerAuthException({required this.service, required this.message, this.statusCode, this.isPermanent = false});
|
|
|
|
@override
|
|
String toString() => 'TrackerAuthException(${service.name}): $message';
|
|
}
|
|
|
|
class TrackerRateLimitException implements Exception {
|
|
final TrackerService service;
|
|
final int? retryAfterSeconds;
|
|
|
|
const TrackerRateLimitException({required this.service, this.retryAfterSeconds});
|
|
|
|
@override
|
|
String toString() => 'TrackerRateLimitException(${service.name}, retry-after: $retryAfterSeconds s)';
|
|
}
|