Skip to content

Commit

Permalink
refactor(validate): minor log improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
hugotiburtino committed Oct 29, 2024
1 parent a5a9c47 commit 8ef6508
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions validate_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@
try:
validator(learning_resource)
except fastjsonschema.JsonSchemaException as e:
failures.append(f"Failed at {learning_resource['id']}. Error: {e}, instead of {e.value}")
failures.append(
f"Failed at {learning_resource['id']}. Error: {e}, instead of {e.value}"
)

t1 = time.time()

delta = t1 - t0
time_info = f"Time needed: {t1 - t0}"

if len(failures) > 0:
total_failures = len(failures)

if total_failures > 0:
for failure in failures:
print(failure)
print(f"Validation failed. Time needed: {delta}")
print(f"{len(total_failures)} validations failed. {time_info}")
raise fastjsonschema.JsonSchemaException

print(f"Validation successful. Time needed: {delta}")
print(f"Validation successful. {time_info}")

0 comments on commit 8ef6508

Please sign in to comment.