mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Improve error handling and PWA manifest
This commit is contained in:
+5
-2
@@ -48,12 +48,15 @@ class Mode(str, Enum):
|
||||
def from_name(name):
|
||||
"""Convert a string to an enum mode using the alias table."""
|
||||
|
||||
if not name:
|
||||
return Mode.UNKNOWN
|
||||
|
||||
try:
|
||||
return Mode(name.upper())
|
||||
except ValueError:
|
||||
except (KeyError, ValueError):
|
||||
try:
|
||||
return Mode(MODE_ALIASES[name.upper()])
|
||||
except ValueError:
|
||||
except (KeyError, ValueError):
|
||||
return Mode.UNKNOWN
|
||||
|
||||
|
||||
|
||||
+4
-1
@@ -42,6 +42,9 @@ def infer_mode_type_from_mode(mode: str) -> ModeType:
|
||||
if not mode:
|
||||
return ModeType.UNKNOWN
|
||||
|
||||
if mode in MODE_ALIASES:
|
||||
mode = MODE_ALIASES[mode]
|
||||
|
||||
try:
|
||||
mode = Mode(mode.upper())
|
||||
if mode.is_cw:
|
||||
@@ -118,7 +121,7 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
|
||||
|
||||
country = data.get("country", None)
|
||||
dxcc_id = data.get("adif", None)
|
||||
continent = Continent(data.get("continent", None))
|
||||
continent = Continent(data["continent"]) if "continent" in data else None
|
||||
cq_zone = data.get("cqz", None)
|
||||
itu_zone = data.get("ituz", None)
|
||||
lat = float(data["latitude"]) if "latitude" in data else None
|
||||
|
||||
Reference in New Issue
Block a user