LCOV - code coverage report

Current view
top level - src/exceptions - squadron_canceled_exception.dart
Test
lcov.info
Date
2024-11-13
Legend
Lines
hit
not hit
Branches
taken
not taken
# not executed
HitTotalCoverage
Lines313296.9%
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 '_well_known_exceptions.dart';
5import 'squadron_canceled_exceptions.dart';
6import 'squadron_exception.dart';
7import 'squadron_timeout_exception.dart';
8
9class SquadronCanceledException extends SquadronException
10 implements CanceledException {
116 SquadronCanceledException(
12 this.tokenId, String message, StackTrace? stackTrace)
136 : super.init(message, stackTrace);
14
155 factory SquadronCanceledException.from(String tokenId, CanceledException ex,
16 [StackTrace? stackTrace]) {
175 if (ex is TimeoutCanceledException) {
183 return SquadronTimeoutException(
194 tokenId, ex.message, ex.duration, ex.stackTrace);
204 } else if (ex is CanceledExceptions) {
212 return SquadronCanceledExceptions(
22 tokenId,
233 ex.innerExceptions.map(
244 (e) => SquadronCanceledException.from(tokenId, e, e.stackTrace),
25 ),
26 );
27 } else {
2811 return SquadronCanceledException(tokenId, ex.message, ex.stackTrace);
29 }
302 }
31
32 final String tokenId;
33
343 @override
358 List serialize() => List.unmodifiable([
36 $canceledExceptionType,
375 tokenId,
385 message,
398 stackTrace?.toString(),
402 ]);
41}
42
43const _$type = 0;
44const _$tokenId = 1;
45const _$message = 2;
46const _$stackTrace = 3;
47
48@internal
49extension SquadronCanceledExceptionExt on SquadronCanceledException {
505 static SquadronCanceledException? deserialize(List? props) {
512 if (props == null) return null;
525 switch (props[_$type]) {
533 case $canceledExceptionType:
545 return SquadronCanceledException(
555 props[_$tokenId],
565 props[_$message],
578 SquadronException.loadStackTrace(props[_$stackTrace]),
58 );
591 case $canceledExceptionsType:
601 return SquadronCanceledExceptionsExt.deserialize(props);
611 case $timeoutExceptionType:
621 return SquadronTimeoutExceptionExt.deserialize(props);
63 default:
640 return null;
65 }
662 }
67}
Choose Features