Files
fm-orchestrator/module_build_service/common/errors.py
Owen W. Taylor 7761bbf5b4 Tweak behavior of get_compatible_base_module_modulemds
Fix some oddities in the DBResolver implementation of
get_compatible_base_module_modulemds() and make the MBSResolver version -
which was previously just buggy - match that. (Tests for the MBSResolver
version are added in a subsequent commit.)

 * If an empty virtual_streams argument was passed in, *all* streams
   were considered compatible. Throw an exception in this case - it
   should be considered an error.
 * If stream_version_lte=True, but the stream from the base module
   wasn't in the form FOOx.y.z, then throw an exception. This was
   previously treated like stream_version_lte=False, which is just
   a recipe for confusion and mistakes.

test_get_reusable_module_use_latest_build() is rewritten to
comprehensively test all possibilities, including the case that changed
above.

test_add_default_modules_compatible_platforms() is changed to run
under allow_only_compatible_base_modules=False, since it expected
Fedora-style virtual streams (versions not in FOOx.y.z form, all
share the same stream), which doesn't make sense with
allow_only_compatible_base_modules=True.
2022-04-29 15:47:08 -04:00

46 lines
664 B
Python

# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
""" Defines custom exceptions and error handling functions """
from __future__ import absolute_import
class ValidationError(ValueError):
pass
class Unauthorized(ValueError):
pass
class Forbidden(ValueError):
pass
class UnprocessableEntity(ValueError):
pass
class StreamNotXyz(UnprocessableEntity):
pass
class Conflict(ValueError):
pass
class NotFound(ValueError):
pass
class ProgrammingError(ValueError):
pass
class StreamAmbigous(ValueError):
pass
class IgnoreMessage(Exception):
"""Raise if message received from message bus should be ignored"""