mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
use ValueError instead of JSONDecodeError
JSONDecodeError is only available in never python 3 versions and still inherits from ValueError, so we could just use it. Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+3
-2
@@ -96,11 +96,12 @@ class Analytics(object):
|
||||
with open(self.user_id_file, "r") as fobj:
|
||||
try:
|
||||
info = json.load(fobj)
|
||||
return info[self.PARAM_USER_ID]
|
||||
except json.JSONDecodeError as exc:
|
||||
except ValueError as exc:
|
||||
logger.debug("Failed to load user_id: {}".format(exc))
|
||||
return None
|
||||
|
||||
return info[self.PARAM_USER_ID]
|
||||
|
||||
def _get_user_id(self):
|
||||
from dvc.lock import LockError
|
||||
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ class RemoteBase(object):
|
||||
try:
|
||||
with open(path, "r") as fobj:
|
||||
d = json.load(fobj)
|
||||
except json.JSONDecodeError:
|
||||
except ValueError:
|
||||
logger.exception("Failed to load dir cache '{}'".format(path_info))
|
||||
return []
|
||||
finally:
|
||||
|
||||
@@ -5,7 +5,6 @@ import sys
|
||||
import os
|
||||
import errno
|
||||
|
||||
|
||||
# Syntax sugar.
|
||||
_ver = sys.version_info
|
||||
|
||||
|
||||
Reference in New Issue
Block a user