@@ -190,6 +190,23 @@ class InstallationError(PipError):
190
190
"""General exception during installation"""
191
191
192
192
193
+ class FailedToPrepareCandidate (InstallationError ):
194
+ """Raised when we fail to prepare a candidate (i.e. fetch and generate metadata).
195
+
196
+ This is intentionally not a diagnostic error, since the output will be presented
197
+ above this error, when this occurs. This should instead present information to the
198
+ user.
199
+ """
200
+
201
+ def __init__ (
202
+ self , * , package_name : str , requirement_chain : str , failed_step : str
203
+ ) -> None :
204
+ super ().__init__ (f"Failed to build '{ package_name } ' when { failed_step .lower ()} " )
205
+ self .package_name = package_name
206
+ self .requirement_chain = requirement_chain
207
+ self .failed_step = failed_step
208
+
209
+
193
210
class MissingPyProjectBuildRequires (DiagnosticPipError ):
194
211
"""Raised when pyproject.toml has `build-system`, but no `build-system.requires`."""
195
212
@@ -384,7 +401,7 @@ def __init__(
384
401
output_lines : list [str ] | None ,
385
402
) -> None :
386
403
if output_lines is None :
387
- output_prompt = Text ("See above for output." )
404
+ output_prompt = Text ("No available output." )
388
405
else :
389
406
output_prompt = (
390
407
Text .from_markup (f"[red][{ len (output_lines )} lines of output][/]\n " )
@@ -412,15 +429,15 @@ def __str__(self) -> str:
412
429
return f"{ self .command_description } exited with { self .exit_code } "
413
430
414
431
415
- class MetadataGenerationFailed (InstallationSubprocessError , InstallationError ):
432
+ class MetadataGenerationFailed (DiagnosticPipError , InstallationError ):
416
433
reference = "metadata-generation-failed"
417
434
418
435
def __init__ (
419
436
self ,
420
437
* ,
421
438
package_details : str ,
422
439
) -> None :
423
- super (InstallationSubprocessError , self ).__init__ (
440
+ super ().__init__ (
424
441
message = "Encountered error while generating package metadata." ,
425
442
context = escape (package_details ),
426
443
hint_stmt = "See above for details." ,
0 commit comments