[App] Add cloud platform exception (#13928)

Co-authored-by: Adrian Wälchli <aedu.waelchli@gmail.com>
This commit is contained in:
Adam Bobowski 2022-08-22 22:15:36 +02:00 committed by GitHub
parent 7a617ec90e
commit 4c47619f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -518,7 +518,11 @@ class LightningWork(abc.ABC):
@abc.abstractmethod
def run(self, *args, **kwargs):
"""Override to add your own logic."""
"""Override to add your own logic.
Raises:
LightningPlatformException: If resource exceeds platform quotas or other constraints.
"""
pass
def on_exception(self, exception: BaseException):

View File

@ -41,6 +41,14 @@ class LightningWorkException(Exception):
"""Exception used to inform users of misuse with LightningWork."""
class LightningPlatformException(Exception): # pragma: no cover
"""Exception used to inform users of issues related to platform the LightningApp is running on.
It gets raised by the Lightning Launcher on the platform side when the app is running in the cloud, and is useful
when framework or user code needs to catch exceptions specific to the platform, e.g., when resources exceed quotas.
"""
class LightningAppStateException(Exception):
"""Exception to inform users of app state errors."""