Source code for lupkg.exceptions
# -*- coding: utf-8 -*-
[docs]class LupkgProcessingException(Exception):
"""Custom exception for lupkg processing related errors."""
def __init__(self, message):
super(LupkgProcessingException, self).__init__()
self.message = message
[docs]class LupkgMetadataException(Exception):
"""Custom exception for LuPKG.
Thrown when there is a problem with the provided or missing
metadata, either from user input, or the lupkg repo
structure/format.
Args:
message (str): the message to display
key (str): the key of the metadata value that caused the issue
valid_values (list): valid values for the key in question
"""
def __init__(self, message, key=None, valid_values=None):
super(LupkgMetadataException, self).__init__()
self.message = message
self.key = key
self.valid_values = valid_values
[docs]class LupkgSchemaException(Exception):
def __init__(self, message, item=None, validation_errors=None):
super(LupkgSchemaException, self).__init__(message)
self.message = "{}: {}".format(message, validation_errors)
self.item = item
self.validation_errors = validation_errors