Compare commits
2 Commits
3faa98a60e
...
79951f3c4b
Author | SHA1 | Date |
---|---|---|
Thomas Nahuel Rusiecki | 79951f3c4b | |
Thomas Nahuel Rusiecki | f8beb0c6e6 |
|
@ -35,12 +35,14 @@ class UploadForm(forms.Form):
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if exist_annotation:
|
if exist_annotation:
|
||||||
raise ValidationError("error: {} exist".format(file_name))
|
raise ValidationError("Error! Snapshot: {} already exists".format(file_name))
|
||||||
|
|
||||||
except ValueError:
|
except json.JSONDecodeError:
|
||||||
raise ValidationError("Error in parsing JSON: {}. Check for file corruption.".format(file_name))
|
raise ValidationError("Error in parsing JSON: '{}'. Check for file integrity.".format(file_name))
|
||||||
except Exception:
|
except ValidationError as e:
|
||||||
raise ValidationError("error in: {}".format(file_name))
|
raise e
|
||||||
|
except Exception as e:
|
||||||
|
raise ValidationError("Oops! Something went wrong in '{}': {}".format(file_name, str(e)))
|
||||||
|
|
||||||
self.evidences.append((file_name, file_json))
|
self.evidences.append((file_name, file_json))
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,15 @@ class Command(BaseCommand):
|
||||||
with open(filepath, 'r') as file:
|
with open(filepath, 'r') as file:
|
||||||
content = json.loads(file.read())
|
content = json.loads(file.read())
|
||||||
path_name = save_in_disk(content, self.user.institution.name)
|
path_name = save_in_disk(content, self.user.institution.name)
|
||||||
|
|
||||||
self.snapshots.append((content, path_name))
|
self.snapshots.append((content, path_name))
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError as e:
|
||||||
raise ValueError(f"Invalid JSON format in file {filepath}.")
|
raise e
|
||||||
#or we cath'em all
|
#or we cath'em all
|
||||||
except Exception as e:
|
except Exception:
|
||||||
raise Exception(f"Oops! Something went wrong there")
|
raise Exception(f"Oops! Something went wrong there")
|
||||||
|
|
||||||
|
|
||||||
def parsing(self):
|
def parsing(self):
|
||||||
for s, p in self.snapshots:
|
for s, p in self.snapshots:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue