-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1093 from carmenbianca/refactor-exceptions
Refactor exceptions
- Loading branch information
Showing
12 changed files
with
115 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# SPDX-FileCopyrightText: 2017 Free Software Foundation Europe e.V. <https://fsfe.org> | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
"""All exceptions owned by :mod:`reuse`. These exceptions all inherit | ||
:class:`ReuseError`. | ||
""" | ||
|
||
from typing import Any, Optional | ||
|
||
|
||
class ReuseError(Exception): | ||
"""Base exception.""" | ||
|
||
|
||
class SpdxIdentifierNotFoundError(ReuseError): | ||
"""Could not find SPDX identifier for license file.""" | ||
|
||
|
||
class GlobalLicensingParseError(ReuseError): | ||
"""An exception representing any kind of error that occurs when trying to | ||
parse a :class:`reuse.global_licensing.GlobalLicensing` file. | ||
""" | ||
|
||
def __init__(self, *args: Any, source: Optional[str] = None): | ||
super().__init__(*args) | ||
self.source = source | ||
|
||
|
||
class GlobalLicensingParseTypeError(GlobalLicensingParseError, TypeError): | ||
"""An exception representing a type error while trying to parse a | ||
:class:`reuse.global_licensing.GlobalLicensing` file. | ||
""" | ||
|
||
|
||
class GlobalLicensingParseValueError(GlobalLicensingParseError, ValueError): | ||
"""An exception representing a value error while trying to parse a | ||
:class:`reuse.global_licensing.GlobalLicensing` file. | ||
""" | ||
|
||
|
||
class GlobalLicensingConflictError(ReuseError): | ||
"""There are two global licensing files in the project that are not | ||
compatible. | ||
""" | ||
|
||
|
||
class MissingReuseInfoError(ReuseError): | ||
"""Some REUSE information is missing from the result.""" | ||
|
||
|
||
class CommentError(ReuseError): | ||
"""An error occurred during an interaction with a comment.""" | ||
|
||
|
||
class CommentCreateError(Exception): | ||
"""An error occurred during the creation of a comment.""" | ||
|
||
|
||
class CommentParseError(Exception): | ||
"""An error occurred during the parsing of a comment.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.