Skip to content
Snippets Groups Projects
Commit 4222593a authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Explicit error message for corpus_id type in check_required_types

parent d7a31281
No related branches found
No related tags found
No related merge requests found
Pipeline #78736 passed
# -*- coding: utf-8 -*-
import uuid
from peewee import IntegrityError
......@@ -20,6 +21,9 @@ class ElementMixin(object):
Check that a corpus has a list of required element types,
and raise an exception if any of them are missing.
"""
assert isinstance(
corpus_id, (uuid.UUID, str)
), "Corpus ID should be a string or UUID"
assert len(type_slugs), "At least one element type slug is required."
assert all(
isinstance(slug, str) for slug in type_slugs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment