Compare commits

..

No commits in common. "79951f3c4b4054dfb6b5a2583778568147fe7cd9" and "3faa98a60e4f136254d89793af76da4464a87536" have entirely different histories.

2 changed files with 9 additions and 13 deletions

View File

@ -35,14 +35,12 @@ class UploadForm(forms.Form):
).first()
if exist_annotation:
raise ValidationError("Error! Snapshot: {} already exists".format(file_name))
raise ValidationError("error: {} exist".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)))
except ValueError:
raise ValidationError("Error in parsing JSON: {}. Check for file corruption.".format(file_name))
except Exception:
raise ValidationError("error in: {}".format(file_name))
self.evidences.append((file_name, file_json))

View File

@ -53,17 +53,15 @@ 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 as e:
raise e
except json.JSONDecodeError:
raise ValueError(f"Invalid JSON format in file {filepath}.")
#or we cath'em all
except Exception:
except Exception as e:
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)