File: exceptions.py

package info (click to toggle)
python-moto 5.1.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 116,520 kB
  • sloc: python: 636,725; javascript: 181; makefile: 39; sh: 3
file content (34 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download
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
import json
from typing import Optional

from moto.core.exceptions import JsonRESTError


class AthenaClientError(JsonRESTError):
    def __init__(self, code: str, message: str):
        super().__init__(error_type="InvalidRequestException", message=message)
        self.description = json.dumps(
            {
                "Error": {
                    "Code": code,
                    "Message": message,
                    "Type": "InvalidRequestException",
                },
                "RequestId": "6876f774-7273-11e4-85dc-39e55ca848d1",
            }
        )


class InvalidArgumentException(JsonRESTError):
    """The specified input parameter has a value that is not valid."""

    code = 400

    def __init__(self, message: str):
        super().__init__("InvalidArgumentException", message)


class QueryStillRunning(JsonRESTError):
    def __init__(self, current_status: Optional[str]):
        msg = f"Query has not yet finished. Current state: {current_status}"
        super().__init__("InvalidRequestException", msg)