LCOV - code coverage report

Current view
top level - src/exceptions - squadron_canceled_exception.dart
Test
lcov.info
Date
2025-03-26
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines2727100.0%
Functions00-
Branches00-
Each row represents a line of source code
LineBranchHitsSource code
1import 'package:cancelation_token/cancelation_token.dart';
2import 'package:meta/meta.dart';
3
4import '_builtin_exceptions.dart';
5import 'squadron_canceled_exceptions.dart';
6import 'squadron_exception.dart';
7import 'squadron_timeout_exception.dart';
8
9class SquadronCanceledException extends SquadronException
10 implements CanceledException {
113 SquadronCanceledException(
12 this.tokenId, String message, StackTrace? stackTrace)
133 : super.init(message, stackTrace);
14
153 factory SquadronCanceledException.from(String tokenId, CanceledException ex,
16 [StackTrace? stackTrace]) {
173 if (ex is TimeoutCanceledException) {
181 return SquadronTimeoutException(
193 tokenId, ex.message, ex.duration, ex.stackTrace);
203 } else if (ex is CanceledExceptions) {
211 return SquadronCanceledExceptions(
22 tokenId,
232 ex.innerExceptions.map(
243 (e) => SquadronCanceledException.from(tokenId, e, e.stackTrace),
25 ),
26 );
27 } else {
289 return SquadronCanceledException(tokenId, ex.message, ex.stackTrace);
29 }
30 }
31
32 final String tokenId;
33
343 @override
356 List serialize() => List.unmodifiable([
36 $canceledExceptionType,
373 tokenId,
383 message,
396 stackTrace?.toString(),
40 ]);
41}
42
43const _$type = 0;
44const _$tokenId = 1;
45const _$message = 2;
46const _$stackTrace = 3;
47
48@internal
49extension SquadronCanceledExceptionExt on SquadronCanceledException {
503 static SquadronCanceledException? deserialize(List? props) {
51 if (props == null) return null;
523 switch (props[_$type]) {
533 case $canceledExceptionType:
543 return SquadronCanceledException(
553 props[_$tokenId],
563 props[_$message],
576 SquadronException.loadStackTrace(props[_$stackTrace]),
58 );
591 case $canceledExceptionsType:
601 return SquadronCanceledExceptionsExt.deserialize(props);
611 case $timeoutExceptionType:
621 return SquadronTimeoutExceptionExt.deserialize(props);
63 default:
64 return null;
65 }
66 }
67}
Choose Features