• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 20332790708

18 Dec 2025 09:48AM UTC coverage: 64.992% (-15.3%) from 80.295%
20332790708

Pull #22949

github

web-flow
Merge f730a56cd into 407284c67
Pull Request #22949: Add experimental uv resolver for Python lockfiles

54 of 97 new or added lines in 5 files covered. (55.67%)

8270 existing lines in 295 files now uncovered.

48990 of 75379 relevant lines covered (64.99%)

1.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
/src/python/pants/base/exceptions.py
1
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
5✔
5

6
from typing import TYPE_CHECKING
5✔
7

8
from pants.engine.internals.native_engine import EngineError as EngineError  # noqa: F401
5✔
9
from pants.engine.internals.native_engine import (  # noqa: F401
5✔
10
    IncorrectProductError as IncorrectProductError,
11
)
12
from pants.engine.internals.native_engine import IntrinsicError as IntrinsicError  # noqa: F401
5✔
13

14
if TYPE_CHECKING:
15
    from pants.engine.internals.native_engine import PyFailure
16

17

18
class PantsException(Exception):
5✔
19
    """Base exception type for Pants."""
20

21

22
class TargetDefinitionException(PantsException):
5✔
23
    """Indicates an invalid target definition.
24

25
    :API: public
26
    """
27

28
    def __init__(self, target, msg):
5✔
29
        """
30
        :param target: the target in question
31
        :param string msg: a description of the target misconfiguration
32
        """
33
        super().__init__(f"Invalid target {target}: {msg}")
×
34

35

36
class BuildConfigurationError(PantsException):
5✔
37
    """Indicates an error in a pants installation's configuration."""
38

39

40
class BackendConfigurationError(BuildConfigurationError):
5✔
41
    """Indicates a plugin backend with a missing or malformed register module."""
42

43

44
class MappingError(PantsException):
5✔
45
    """Indicates an error mapping addressable objects."""
46

47

48
class RuleTypeError(PantsException):
5✔
49
    """Invalid @rule implementation."""
50

51

52
class NativeEngineFailure(Exception):
5✔
53
    """A wrapper around a `Failure` instance.
54

55
    The failure instance being wrapped can come from an exception raised in a rule. When this
56
    failure is returned to a requesting rule it is first unwrapped so the original exception will be
57
    presented in the rule, thus the `NativeEngineFailure` exception will not be seen in rule code.
58

59
    This is different from the other `EngineError` based exceptions which doesn't originate from
60
    rule code.
61

62
    TODO: This type is defined in Python because pyo3 doesn't support declaring Exceptions with
63
    additional fields. See https://github.com/PyO3/pyo3/issues/295
64
    """
65

66
    def __init__(self, msg: str, failure: PyFailure) -> None:
5✔
UNCOV
67
        super().__init__(msg)
×
UNCOV
68
        self.failure = failure
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc