-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DPE-2082] User-friendly output when no primary account is defined (#21)
- Loading branch information
Showing
10 changed files
with
770 additions
and
577 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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 |
---|---|---|
@@ -1,16 +1,50 @@ | ||
class K8sClusterNotReachable(Exception): | ||
"""Kubernetes cluster cannot be reached successfully by the client.""" | ||
|
||
def __init__(self, k8s_master: str): | ||
self.k8s_master = k8s_master | ||
|
||
|
||
class NoAccountFound(Exception): | ||
pass | ||
class ResourceNotFound(FileNotFoundError): | ||
"""General Exception representing a general resource not found.""" | ||
|
||
def __init__(self, resource_name: str): | ||
self.resource_name = resource_name | ||
|
||
class FormatError(SyntaxError): | ||
pass | ||
|
||
class K8sResourceNotFound(ResourceNotFound): | ||
"""Requested resource in K8s cannot be found.""" | ||
|
||
class NoResourceFound(FileNotFoundError): | ||
def __init__(self, resource_name: str): | ||
self.resource_name = resource_name | ||
def __init__(self, resource_name: str, resource_type: str): | ||
super().__init__(resource_name) | ||
self.resource_type = resource_type | ||
|
||
|
||
class PrimaryAccountNotFound(ResourceNotFound): | ||
"""Requested primary account cannot be fetched as there exists no account labeled as primary.""" | ||
|
||
def __init__(self): | ||
super().__init__("primary") | ||
|
||
def __str__(self) -> str: | ||
return "Primary account not found. Please create or tag an account as primary." | ||
|
||
|
||
class AccountNotFound(ResourceNotFound): | ||
"""Requested Spark account that does not exist.""" | ||
|
||
def __init__(self, account: str): | ||
super().__init__(account) | ||
|
||
@property | ||
def account(self): | ||
return self.resource_name | ||
|
||
def __str__(self) -> str: | ||
return f"Account {self.account} not found" | ||
|
||
|
||
class FormatError(SyntaxError): | ||
"""Exception to be used when input provided by the user cannot be parsed.""" | ||
|
||
pass |
Oops, something went wrong.