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()
|
||||
|
||||
if exist_annotation:
|
||||
raise ValidationError("error: {} exist".format(file_name))
|
||||
raise ValidationError("Error! Snapshot: {} already exists".format(file_name))
|
||||
|
||||
except ValueError:
|
||||
raise ValidationError("Error in parsing JSON: {}. Check for file corruption.".format(file_name))
|
||||
except Exception:
|
||||
raise ValidationError("error in: {}".format(file_name))
|
||||
except json.JSONDecodeError:
|
||||
raise ValidationError("Error in parsing JSON: '{}'. Check for file integrity.".format(file_name))
|
||||
except ValidationError as e:
|
||||
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))
|
||||
|
||||
|
|
|
@ -53,15 +53,17 @@ class Command(BaseCommand):
|
|||
with open(filepath, 'r') as file:
|
||||
content = json.loads(file.read())
|
||||
path_name = save_in_disk(content, self.user.institution.name)
|
||||
|
||||
self.snapshots.append((content, path_name))
|
||||
except json.JSONDecodeError:
|
||||
raise ValueError(f"Invalid JSON format in file {filepath}.")
|
||||
except json.JSONDecodeError as e:
|
||||
raise e
|
||||
#or we cath'em all
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(f"Oops! Something went wrong there")
|
||||
|
||||
|
||||
def parsing(self):
|
||||
for s, p in self.snapshots:
|
||||
for s, p in self.snapshots:
|
||||
try:
|
||||
self.devices.append(Build(s, self.user))
|
||||
move_json(p, self.user.institution.name)
|
||||
|
|
Loading…
Reference in New Issue