docs/reference/context/fail/async_fail.html
class AsyncFail (client: slack_sdk.web.async_client.AsyncWebClient,function_execution_id: str | None)#Expand source code
class AsyncFail:
client: AsyncWebClient
function_execution_id: Optional[str]
_called: bool
def __init__ (
self,
client: AsyncWebClient,
function_execution_id: Optional[str],
):
self.client = client
self.function_execution_id = function_execution_id
self._called = False
async def __call__ (self, error: str) -> AsyncSlackResponse:
"""Signal that the custom function failed to complete.
Kwargs:
error: Error message to return to slack
Returns:
SlackResponse: The response object returned from slack
Raises:
ValueError: If this function cannot be used.
"""
if self.function_execution_id is None:
raise ValueError("fail is unsupported here as there is no function_execution_id")
self._called = True
return await self.client.functions_completeError(function_execution_id=self.function_execution_id, error=error)
def has_been_called(self) -> bool:
"""Check if this fail function has been called.
Returns:
bool: True if the fail function has been called, False otherwise.
"""
return self._called
var client : slack_sdk.web.async_client.AsyncWebClient
The type of the None singleton.
var function_execution_id : str | None
The type of the None singleton.
def has_been_called(self) ‑> bool#Expand source code
def has_been_called(self) -> bool:
"""Check if this fail function has been called.
Returns:
bool: True if the fail function has been called, False otherwise.
"""
return self._called
Check if this fail function has been called.
boolTrue if the fail function has been called, False otherwise.