Error notification on the web app, "Oops, an error occured" vs "Execution exception"


(Leah) #1

Hello,
I am trying to create an web application using Play Framework and I am running into some issues across different environments.
On my localhost window, I get this error " Execution exception" with description of what the error is.

However in the other environment, it only says “Oops, an error occurred… This exception has been logged with id ****** .”

What makes these two error display different? Is it the logging configuration?

thank you so much for help.:grinning:


(Greg Methvin) #2

Hi Leah,

The default error pages are different in dev mode and prod mode. In dev, Play will provide the exception message. In prod, Play logs the exception with an ID that can be searched for in production logs. The error details are not displayed on the page in prod mode, as it can often be a security risk to expose internal details of a production system. All this can be customized by creating a custom HttpErrorHandler: https://www.playframework.com/documentation/2.6.x/ScalaErrorHandling

Cheers,
Greg


(Leah) #3

Hello Greg,
thank you for answer. Does the custom error handler also cover TechnicalException error? In other words, is TechnicalException also considered a server error?

below is the actual error message I am getting:
[CompletionException: org.pac4j.core.exception.TechnicalException: State parameter is different from the one sent in authentication request. Session expired or possible threat of cross-site request forgery]
I am looking into ways to create a custom error page whenever the user runs into this error. This error occurs when the user is using more than two tabs on one browser to log in and out of.


(Greg Methvin) #4

Any uncaught exception is considered a server error. If you wanted to handle this exception specially, you could implement custom logic in your HttpErrorHandler. I would hope pac4j has a more direct way to handle this case, but I don’t have much experience with that library or its Play integration.