File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ impl ResultName for FailureReason {
13
13
FailureReason :: Unknown => "failed (unknown)" . into ( ) ,
14
14
FailureReason :: Timeout => "timed out" . into ( ) ,
15
15
FailureReason :: NetworkAccess => "network access" . into ( ) ,
16
+ FailureReason :: Docker => "docker" . into ( ) ,
16
17
FailureReason :: OOM => "OOM" . into ( ) ,
17
18
FailureReason :: ICE => "ICE" . into ( ) ,
18
19
FailureReason :: NoSpace => "no space left on device" . into ( ) ,
@@ -27,6 +28,7 @@ impl ResultName for FailureReason {
27
28
FailureReason :: CompilerError ( _) | FailureReason :: DependsOn ( _) => self . to_string ( ) ,
28
29
FailureReason :: Unknown
29
30
| FailureReason :: NetworkAccess
31
+ | FailureReason :: Docker
30
32
| FailureReason :: Timeout
31
33
| FailureReason :: OOM
32
34
| FailureReason :: NoSpace
Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ pub enum FailureReason {
200
200
Timeout ,
201
201
ICE ,
202
202
NetworkAccess ,
203
+ Docker ,
203
204
CompilerDiagnosticChange ,
204
205
CompilerError ( BTreeSet < DiagnosticCode > ) ,
205
206
DependsOn ( BTreeSet < Crate > ) ,
@@ -216,6 +217,7 @@ impl ::std::fmt::Display for FailureReason {
216
217
FailureReason :: Timeout => write ! ( f, "timeout" ) ,
217
218
FailureReason :: ICE => write ! ( f, "ice" ) ,
218
219
FailureReason :: NetworkAccess => write ! ( f, "network-access" ) ,
220
+ FailureReason :: Docker => write ! ( f, "docker" ) ,
219
221
FailureReason :: CompilerError ( codes) => write ! (
220
222
f,
221
223
"compiler-error({})" ,
@@ -283,6 +285,7 @@ impl FailureReason {
283
285
| FailureReason :: NoSpace
284
286
| FailureReason :: Timeout
285
287
| FailureReason :: NetworkAccess
288
+ | FailureReason :: Docker
286
289
| FailureReason :: CompilerDiagnosticChange => true ,
287
290
FailureReason :: CompilerError ( _)
288
291
| FailureReason :: DependsOn ( _)
Original file line number Diff line number Diff line change @@ -17,13 +17,23 @@ use std::io::ErrorKind;
17
17
18
18
fn failure_reason ( err : & Error ) -> FailureReason {
19
19
for cause in err. chain ( ) {
20
- if let Some ( & CommandError :: SandboxOOM ) = cause. downcast_ref ( ) {
21
- return FailureReason :: OOM ;
22
- } else if let Some ( & CommandError :: NoOutputFor ( _) | & CommandError :: Timeout ( _) ) =
23
- cause. downcast_ref ( )
24
- {
25
- return FailureReason :: Timeout ;
26
- } else if let Some ( reason) = cause. downcast_ref :: < FailureReason > ( ) {
20
+ if let Some ( command_error) = cause. downcast_ref :: < CommandError > ( ) {
21
+ match command_error {
22
+ CommandError :: NoOutputFor ( _)
23
+ | CommandError :: Timeout ( _)
24
+ | CommandError :: KillAfterTimeoutFailed ( _) => return FailureReason :: Timeout ,
25
+ CommandError :: SandboxOOM => return FailureReason :: OOM ,
26
+ CommandError :: SandboxImagePullFailed ( _)
27
+ | CommandError :: SandboxImageMissing ( _)
28
+ | CommandError :: SandboxContainerCreate ( _)
29
+ | CommandError :: WorkspaceNotMountedCorrectly
30
+ | CommandError :: InvalidDockerInspectOutput ( _) => return FailureReason :: Docker ,
31
+
32
+ CommandError :: ExecutionFailed { .. } | CommandError :: IO ( _) | _ => { }
33
+ }
34
+ }
35
+
36
+ if let Some ( reason) = cause. downcast_ref :: < FailureReason > ( ) {
27
37
return reason. clone ( ) ;
28
38
} else if let Some ( CommandError :: IO ( io) ) = cause. downcast_ref ( ) {
29
39
match io. kind ( ) {
You can’t perform that action at this time.
0 commit comments