Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2503

Create Exception handler for applications run using StartMain

    Details

    • Type: Feature Request
    • Status: Pull Request Sent (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.4.Final
    • Fix Version/s: 3.1.x
    • Component/s: Java SE Support
    • Labels:
      None
    • Environment:

      All Weld-SE applications

      Description

      Weld-2502 (and it's associated PR) provides a default way to handle Exceptions that escape from the application and end up terminating the JRE. This feature requests suggests that it would be useful to provide an "Exception handler" (Exception mapper?) that allows the developer to provide a handler for one or more Exception types.

      A concrete example why this feature would be useful can be seen when using Weld-SE with Wildfly's Microprofile-Config. According to the 12-Factor app manifesto, a good application receives its configuration from the environment and this mechanism is very convenient in containerized environments. In this configuration, when a required configuration parameter is not provided, a DeploymentException is thrown that contains a list of the configuration properties that are missing (or invalid). I'd like to "intercept" that particular Exception and log a much more human readable set of log messages (akin to a CLI's help message that's shown when CLI arguments aren't deemed suitable). Handling this particular exception also provides the opportunity to suppress the stack-trace as it becomes irrelevant when an appropriate message is shown to the user.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                smoyer64 Steve Moyer
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: