jax-rs-spec
  1. jax-rs-spec
  2. JAX_RS_SPEC-339

Add String message to exception constructors

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None

      Description

      I'm finding I'm doing this a lot:

      new BadRequestException(new Exception("You did something bad"));

      Would be cool if we could set the exception message of all the status exceptions.

        Activity

        Hide
        Marek Potociar added a comment -

        I'm not clear about what is the purpose of the message in your use case? Just to be displayed as an exception message in e.g. a log file or should it somehow be reflected in the response?

        (Reclassifying as minor.)

        Show
        Marek Potociar added a comment - I'm not clear about what is the purpose of the message in your use case? Just to be displayed as an exception message in e.g. a log file or should it somehow be reflected in the response? (Reclassifying as minor.)
        Hide
        Marek Potociar added a comment -

        ...ping...

        Show
        Marek Potociar added a comment - ...ping...
        Hide
        patriot1burke added a comment -

        For the logging of the exception on the serverside to the log file and/or console. Exception.getMessage(). none of the jaxrs exceptions have String parameters to set Exception.getMessage().

        Show
        patriot1burke added a comment - For the logging of the exception on the serverside to the log file and/or console. Exception.getMessage(). none of the jaxrs exceptions have String parameters to set Exception.getMessage().
        Hide
        Marek Potociar added a comment -

        Deferring to future release.

        Show
        Marek Potociar added a comment - Deferring to future release.
        Hide
        patriot1burke added a comment -

        I think it is a bad idea to defer such a trivial change. I'm stuck now with either abandoning the exception hierarchy or doing the hack I described above if I want a meaningful message logged when an exception is thrown on the server side.

        Show
        patriot1burke added a comment - I think it is a bad idea to defer such a trivial change. I'm stuck now with either abandoning the exception hierarchy or doing the hack I described above if I want a meaningful message logged when an exception is thrown on the server side.
        Hide
        patriot1burke added a comment -

        I've emailed you a patch for this.

        Show
        patriot1burke added a comment - I've emailed you a patch for this.
        Hide
        Marek Potociar added a comment -

        Fixed - applied (slightly modified) patch from Bill Burke.

        Show
        Marek Potociar added a comment - Fixed - applied (slightly modified) patch from Bill Burke.

          People

          • Assignee:
            Marek Potociar
            Reporter:
            patriot1burke
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: