handle errors in json files
This commit is contained in:
parent
ef1435cef7
commit
0e8116b743
@ -57,6 +57,9 @@ class Bandplan(object):
|
|||||||
return [Band(d) for d in bands_json]
|
return [Band(d) for d in bands_json]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
logger.exception("error while parsing bandplan from %s", file)
|
||||||
|
return []
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def findBands(self, freq):
|
def findBands(self, freq):
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Bookmark(object):
|
class Bookmark(object):
|
||||||
def __init__(self, j):
|
def __init__(self, j):
|
||||||
@ -45,6 +49,9 @@ class Bookmarks(object):
|
|||||||
return [Bookmark(d) for d in bookmarks_json]
|
return [Bookmark(d) for d in bookmarks_json]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
logger.exception("error while parsing bookmarks from %s", file)
|
||||||
|
return []
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user