-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workaround enabling exception transformers to return arbitrary re…
…turn value
- Loading branch information
Showing
5 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
impl/src/main/java/org/jboss/weld/invokable/ValueCarryingException.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,20 @@ | ||
package org.jboss.weld.invokable; | ||
|
||
class ValueCarryingException extends Exception { | ||
|
||
// we use this method to filter return values of exception transformer into excepted types | ||
static Object hideReturnValue(Object methodRetType) throws ValueCarryingException { | ||
// rethrow method return type inside exception | ||
throw new ValueCarryingException(methodRetType); | ||
} | ||
|
||
|
||
private final Object methodReturnValue; | ||
public ValueCarryingException(Object methodReturnValue) { | ||
this.methodReturnValue = methodReturnValue; | ||
} | ||
|
||
public Object getMethodReturnValue() { | ||
return methodReturnValue; | ||
} | ||
} |
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
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