-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error types and messages (#154)
Signed-off-by: Max Lambrecht <[email protected]>
- Loading branch information
1 parent
89384c0
commit 55f8f3d
Showing
41 changed files
with
670 additions
and
921 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
(C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
not use this file except in compliance with the License. You may obtain | ||
a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations | ||
under the License. | ||
""" | ||
|
||
""" | ||
This module handles JWT bundle exceptions. | ||
""" | ||
|
||
from spiffe.errors import PySpiffeError | ||
|
||
|
||
class JwtBundleError(PySpiffeError): | ||
"""Exception raised for JwtBundle module related errors.""" | ||
|
||
|
||
class ParseJWTBundleError(JwtBundleError): | ||
"""Error raised when unable to parse a JWT bundle from bytes.""" | ||
|
||
def __init__(self, detail: str) -> None: | ||
super().__init__(f'Error parsing JWT bundle: {detail}') | ||
|
||
|
||
class AuthorityNotFoundError(JwtBundleError): | ||
"""Error raised when an authority is not found for a given key ID.""" | ||
|
||
def __init__(self, key_id: str) -> None: | ||
super().__init__(f'Authority not found for key ID: {key_id}') |
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
""" | ||
(C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
not use this file except in compliance with the License. You may obtain | ||
a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations | ||
under the License. | ||
""" | ||
|
||
""" | ||
This module defines X.509 Bundle exceptions. | ||
""" | ||
|
||
from spiffe.errors import PySpiffeError | ||
|
||
|
||
class X509BundleError(PySpiffeError): | ||
"""Exception raised for X509Bundle module related errors.""" | ||
|
||
|
||
class ParseX509BundleError(X509BundleError): | ||
"""Error raised when unable to parse an X.509 bundle from bytes.""" | ||
|
||
def __init__(self, detail: str) -> None: | ||
super().__init__(f'Error parsing X.509 bundle: {detail}') | ||
|
||
|
||
class LoadX509BundleError(X509BundleError): | ||
"""Error raised when unable to load an X.509 bundle from a file.""" | ||
|
||
def __init__(self, path: str) -> None: | ||
super().__init__(f'Error loading X.509 bundle from {path}') | ||
|
||
|
||
class SaveX509BundleError(X509BundleError): | ||
"""Error raised when unable to save an X.509 bundle to a file.""" | ||
|
||
def __init__(self, path: str) -> None: | ||
super().__init__(f'Error saving X.509 bundle to {path}') |
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
""" | ||
(C) Copyright 2021 Hewlett Packard Enterprise Development LP | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
not use this file except in compliance with the License. You may obtain | ||
a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations | ||
under the License. | ||
""" | ||
|
||
""" | ||
This module defines py-spiffe top level exceptions. | ||
""" | ||
|
||
|
||
class PySpiffeError(Exception): | ||
"""Top level exception for py-spiffe library.""" | ||
|
||
|
||
class ArgumentError(PySpiffeError): | ||
"""Validation error for py-spiffe library.""" |
Oops, something went wrong.