added new 'PublishArtistError'

This commit is contained in:
Jakub Trllo 2024-09-02 13:39:22 +02:00
parent 050f816ce4
commit 830dd06869
3 changed files with 29 additions and 12 deletions

View file

@ -51,6 +51,7 @@ from .load import (
)
from .publish import (
PublishArtistError,
PublishValidationError,
PublishXmlValidationError,
KnownPublishError,
@ -164,6 +165,7 @@ __all__ = (
"get_repres_contexts",
# --- Publish ---
"PublishArtistError",
"PublishValidationError",
"PublishXmlValidationError",
"KnownPublishError",

View file

@ -9,6 +9,7 @@ from .publish_plugins import (
AbstractMetaInstancePlugin,
AbstractMetaContextPlugin,
PublishArtistError,
PublishValidationError,
PublishXmlValidationError,
KnownPublishError,
@ -62,6 +63,7 @@ __all__ = (
"AbstractMetaInstancePlugin",
"AbstractMetaContextPlugin",
"PublishArtistError",
"PublishValidationError",
"PublishXmlValidationError",
"KnownPublishError",

View file

@ -25,27 +25,40 @@ class AbstractMetaContextPlugin(ABCMeta, ExplicitMetaPlugin):
pass
class PublishValidationError(Exception):
"""Validation error happened during publishing.
class PublishArtistError(Exception):
"""Publishing crashed because of known error.
This exception should be used when validation publishing failed.
Has additional UI specific attributes that may be handy for artist.
Message will be shown in UI for artist.
Args:
message(str): Message of error. Short explanation an issue.
title(str): Title showed in UI. All instances are grouped under
single title.
description(str): Detailed description of an error. It is possible
to use Markdown syntax.
"""
message (str): Message of error. Short explanation an issue.
title (Optional[str]): Title showed in UI.
description (Optional[str]): Detailed description of an error.
It is possible to use Markdown syntax.
"""
def __init__(self, message, title=None, description=None, detail=None):
self.message = message
self.title = title
self.description = description or message
self.detail = detail
super(PublishValidationError, self).__init__(message)
super().__init__(message)
class PublishValidationError(PublishArtistError):
"""Validation error happened during publishing.
This exception should be used when validation publishing failed.
Publishing does not stop during validation order if this
exception is raised.
Has additional UI specific attributes that may be handy for artist.
Argument 'title' is used to group errors.
"""
pass
class PublishXmlValidationError(PublishValidationError):