-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle error case for source exception
Signed-off-by: adarsh0728 <[email protected]>
- Loading branch information
1 parent
cd6fd96
commit fd1f19a
Showing
3 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/main/java/io/numaproj/numaflow/shared/ExceptionUtils.java
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,24 @@ | ||
package io.numaproj.numaflow.shared; | ||
|
||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
|
||
public class ExceptionUtils { | ||
/** | ||
* Formalized exception error strings | ||
*/ | ||
public static final String ERR_SOURCE_EXCEPTION = "UDF_EXECUTION_ERROR(source)"; | ||
public static final String ERR_TRANSFORMER_EXCEPTION = "UDF_EXECUTION_ERROR(transformer)"; | ||
|
||
/** | ||
* Converts the stack trace of an exception into a String. | ||
* | ||
* @param e the exception to extract the stack trace from | ||
* @return the stack trace as a String | ||
*/ | ||
public static String getStackTrace(Exception e) { | ||
StringWriter sw = new StringWriter(); | ||
e.printStackTrace(new PrintWriter(sw)); | ||
return sw.toString(); | ||
} | ||
} |
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