forked from aws/aws-lambda-java-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStackTraceHelper.java
More file actions
33 lines (28 loc) · 1.07 KB
/
StackTraceHelper.java
File metadata and controls
33 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
package testpkg;
import com.amazonaws.services.lambda.crac.CheckpointException;
/**
* A helper class for throwing exception which is not in the com.amazonaws.services.lambda.runtime.api.client package
* to avoid the stack traces from being filtered out.
*
*/
public class StackTraceHelper {
/**
* Throws a RuntimeException directly with msg as the message.
*/
public static void throwRuntimeException(String msg){
throw new RuntimeException(msg);
}
/**
* Calls another method which throws a RuntimeException with msg as the message.
*/
public static void callThenThrowRuntimeException(String msg){
throwRuntimeException(msg);
}
public static void throwCheckpointExceptionWithTwoSuppressedExceptions(String msg1, String msg2) throws CheckpointException {
CheckpointException e1 = new CheckpointException();
e1.addSuppressed(new RuntimeException(msg1));
e1.addSuppressed(new RuntimeException(msg2));
throw e1;
}
}