You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
improve error message when Package.resolved cannot be loaded (#3721)
* improve error message when Package.resolved cannot be loaded
motivation: provide clear and actionable information when trying to load pacakge.resolved file from a non-supported version, or otherwise malformed.
changes:
* add contextual information to error message
* add few tests
XCTAssertThrowsError(tryPinsStore(pinsFile: pinsFile, workingDirectory:.root, fileSystem: fs, mirrors:.init()),"error expected",{ error in
187
+
XCTAssertEqual("\(error)","Package.resolved file is corrupted or malformed; fix or delete the file to continue: unknown 'PinsStorage' version '\(version)' at '\(pinsFile)'.")
188
+
})
189
+
190
+
}
191
+
192
+
func testLoadingBadFormat()throws{
193
+
letfs=InMemoryFileSystem()
194
+
letpinsFile=AbsolutePath("/pinsfile.txt")
195
+
196
+
try fs.writeFileContents(pinsFile, string:"boom")
197
+
198
+
XCTAssertThrowsError(tryPinsStore(pinsFile: pinsFile, workingDirectory:.root, fileSystem: fs, mirrors:.init()),"error expected",{ error in
199
+
XCTAssertMatch("\(error)",.contains("Package.resolved file is corrupted or malformed; fix or delete the file to continue"))
0 commit comments