surplus: remove unnecessary exceptions
This commit is contained in:
parent
d67d72cdd5
commit
a7803ec3ca
15
surplus.py
15
surplus.py
|
@ -31,14 +31,12 @@ For more information, please refer to <http:m/unlicense.org/>
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from dataclasses import dataclass
|
|
||||||
from sys import stderr, stdout
|
from sys import stderr, stdout
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
Final,
|
Final,
|
||||||
Generic,
|
Generic,
|
||||||
Literal,
|
|
||||||
NamedTuple,
|
NamedTuple,
|
||||||
TextIO,
|
TextIO,
|
||||||
TypeAlias,
|
TypeAlias,
|
||||||
|
@ -117,18 +115,10 @@ OUTPUT_LINE_6_KEYS: Final[tuple[str, ...]] = (
|
||||||
# exceptions
|
# exceptions
|
||||||
|
|
||||||
|
|
||||||
class InvalidPlusCodeError(Exception):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class NoSuitableLocationError(Exception):
|
class NoSuitableLocationError(Exception):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
class InvalidQueryError(Exception):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
# data structures
|
# data structures
|
||||||
|
|
||||||
ResultType = TypeVar("ResultType")
|
ResultType = TypeVar("ResultType")
|
||||||
|
@ -262,10 +252,7 @@ class PlusCodeQuery(NamedTuple):
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return Result[Latlong](
|
return Result[Latlong](
|
||||||
EMPTY_LATLONG,
|
EMPTY_LATLONG, error="Plus Code is not full-length, e.g, 6PH58QMF+FX"
|
||||||
error=InvalidPlusCodeError(
|
|
||||||
"Plus Code is not full-length, e.g, 6PH58QMF+FX"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|
Loading…
Reference in a new issue