raise_exception
Applicability
Product |
Supported |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
Function Description
The UDF proactively reports an exception.
Prototype
1 | raise_exception(self, exception_code: int, user_context_id: int) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
exception_code |
Input |
User-defined error code for an exception. |
user_context_id |
Input |
Context ID of a user-defined exception, which is used to identify the reported exception. This ensures that other UDFs can detect the data batch where the exception occurs based on the ID after capturing the exception. |
Returns
None
Exception Handling
Print error logs.
Constraints
If exception reporting is not enabled for the current dataflow graph through the set_exception_catch API, calling this API will cause the process to report an error and exit.
In scenarios with streaming input (the input parameter of FlowFunc is a queue), the UDF cannot proactively report exceptions.