Skip to content

Commit 79b090a

Browse files
authored
Handle RequestException alongside ApiResponseException. (#8813)
1 parent 482b22b commit 79b090a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/pub_worker/lib/src/analyze.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ Future<void> analyze(Payload payload) async {
108108
}
109109
} on TaskAbortedException catch (e, st) {
110110
warnTaskAborted(e, st);
111+
} on RequestException catch (e, st) {
112+
late final map = e.bodyAsJson();
113+
late final error = map['error'];
114+
late final code = map['code'] ?? (error is Map ? error['code'] : null);
115+
if (e.status == 400 && code is String && code == 'TaskAborted') {
116+
warnTaskAborted(e, st);
117+
} else {
118+
shoutTaskError(e, st);
119+
}
111120
} on ApiResponseException catch (e, st) {
112121
if (e.status == 400 && e.code == 'TaskAborted') {
113122
warnTaskAborted(e, st);

0 commit comments

Comments
 (0)