rethrow(e) doesn't wrap the exception, so there's no useless exception.

On 24 July 2017 at 15:34, Mikael Ståldal <[email protected]> wrote:

> I could use "Throwables.rethrow(e)", but is that really better than "throw
> new RuntimeException(e)"?
>
>
>
> On 2017-07-24 22:06, Matt Sicker wrote:
>
>> Java 8 added an UncheckedIOException class which is handy for rethrowing
>> IOException. Since we're on 7, that class isn't available. However, if you
>> just want to throw it, you can use the rethrow() method in Throwables
>> which
>> won't wrap the exception (abuses type erasure to allow checked exceptions
>> to be thrown).
>>
>> On 24 July 2017 at 14:56, Mikael Ståldal <[email protected]> wrote:
>>
>> But that won't work, I need to at least translate JsonProcessingException
>>> (Jackson specific, which we don't want to expose) to our own
>>> ParseException.
>>>
>>>
>>>
>>> On 2017-07-23 22:01, Gary Gregory wrote:
>>>
>>>       @Override
>>>>       public LogEvent parseFrom(InputStream input) throws IOException,
>>>> ParseException {
>>>>           return objectReader.readValue(input);
>>>>       }
>>>>
>>>>
>>>
>>
>>
>


-- 
Matt Sicker <[email protected]>

Reply via email to