Skip to content

Commit

Permalink
exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryzak committed Mar 14, 2011
1 parent 7de53f6 commit 69338e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion examples/authorization/pom.xml
Expand Up @@ -60,7 +60,12 @@

<dependency>
<groupId>org.jboss.seam.faces</groupId>
<artifactId>seam-faces</artifactId>
<artifactId>seam-faces-api</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.seam.faces</groupId>
<artifactId>seam-faces-impl</artifactId>
</dependency>

<!-- CDI (JSR-299) -->
Expand Down
Expand Up @@ -7,6 +7,9 @@
import org.jboss.seam.exception.control.CaughtException;
import org.jboss.seam.exception.control.Handles;
import org.jboss.seam.exception.control.HandlesExceptions;
import org.jboss.seam.exception.filter.StackFrame;
import org.jboss.seam.exception.filter.StackFrameFilter;
import org.jboss.seam.exception.filter.StackFrameFilterResult;
import org.jboss.seam.security.AuthorizationException;

/**
Expand All @@ -20,10 +23,19 @@ public class ExceptionHandler
{
@Inject FacesContext facesContext;

final StackFrameFilter<AuthorizationException> filter = new StackFrameFilter<AuthorizationException>() {
@Override
public StackFrameFilterResult process(StackFrame frame) {
return StackFrameFilterResult.TERMINATE_AFTER;
}
};

public void handleAuthorizationException(@Handles CaughtException<AuthorizationException> evt)
{
facesContext.addMessage(null, new FacesMessage(
"You do not have the necessary permissions to perform that operation"));
evt.markHandled();
evt.handled();

//filter.process(evt.getExceptionStack());
}
}

0 comments on commit 69338e6

Please sign in to comment.