Skip to content

Commit cb888f5

Browse files
authored
state file parsing errors should not assert (#3865)
motivation: state parsing is a "legitimate" error that we handle gracefuly and should not assert on changes: use StringError instead of InternalError when encountering invalid kind/type attribute
1 parent 72cfc88 commit cb888f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/Workspace/WorkspaceState.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ extension WorkspaceStateStorage {
236236
let path = try container.decode(AbsolutePath?.self, forKey: .path)
237237
return try self.init(underlying: .edited(basedOn: basedOn.map { try .init($0) }, unmanagedPath: path))
238238
default:
239-
throw InternalError("unknown checkout state \(kind)")
239+
throw StringError("unknown dependency state \(kind)")
240240
}
241241
}
242242

@@ -318,7 +318,7 @@ extension WorkspaceStateStorage {
318318
let checksum = try container.decode(String.self, forKey: .checksum)
319319
self.init(underlying: .remote(url: url, checksum: checksum))
320320
default:
321-
throw InternalError("unknown checkout state \(kind)")
321+
throw StringError("unknown artifact source \(kind)")
322322
}
323323
}
324324

@@ -518,7 +518,7 @@ extension WorkspaceStateStorage {
518518
let path = try container.decode(AbsolutePath?.self, forKey: .path)
519519
return try self.init(underlying: .edited(basedOn: basedOn.map { try .init($0) }, unmanagedPath: path))
520520
default:
521-
throw InternalError("unknown checkout state \(kind)")
521+
throw StringError("unknown dependency state \(kind)")
522522
}
523523
}
524524

@@ -578,7 +578,7 @@ extension WorkspaceStateStorage {
578578
let checksum = try container.decode(String.self, forKey: .checksum)
579579
self.init(underlying: .remote(url: url, checksum: checksum))
580580
default:
581-
throw InternalError("unknown checkout state \(kind)")
581+
throw StringError("unknown artifact source \(kind)")
582582
}
583583
}
584584

0 commit comments

Comments
 (0)