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

Create Exception handler for applications run using StartMain

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Minor Minor
    • 3.1.x
    • 3.0.4.Final
    • Java SE Support
    • None

      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.

              Unassigned Unassigned
              smoyer64 Steve Moyer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: