File: exceptions.py

package info (click to toggle)
python-openapi-core 0.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,104 kB
  • sloc: python: 19,979; makefile: 44
file content (46 lines) | stat: -rw-r--r-- 841 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from dataclasses import dataclass

from openapi_core.exceptions import OpenAPIError


class PathError(OpenAPIError):
    """Path error"""


@dataclass
class PathNotFound(PathError):
    """Path not found"""

    url: str

    def __str__(self) -> str:
        return f"Path not found for {self.url}"


@dataclass
class PathsNotFound(PathNotFound):
    """Paths not found"""

    def __str__(self) -> str:
        return f"Paths not found in spec: {self.url}"


@dataclass
class OperationNotFound(PathError):
    """Find path operation error"""

    url: str
    method: str

    def __str__(self) -> str:
        return f"Operation {self.method} not found for {self.url}"


@dataclass
class ServerNotFound(PathError):
    """Find server error"""

    url: str

    def __str__(self) -> str:
        return f"Server not found for {self.url}"