Re: Proposal for creating a CompositeException in ExceptionUtils

2020-10-21 Thread Thomas
I understand the use case.

But starting with JDK 7, java.lang.Throwable has

   Throwable#addSuppressed(Throwable)

   Throwable[] getSuppressed()

which would lend themselves pretty obviously to the purpose, at least if
the mechanism hasn't been disabled using the special ctor

protected Throwable(String message, Throwable cause,
    boolean enableSuppression,
    boolean writableStackTrace)

And the suppressed are printed!

So, probably, we are loading ourselves with future redundancy, aren't we?  

On 17.07.2020 20:10, Adwait Kumar Singh wrote:
> Sample use cases:
> 1. Perform multiple operations, some failed due to different reasons.
> Return a CompositeException for the failed ones.
> 2. Do a validation on some input. I want to collect all different failures,
> I can throw a CompositeException.
> 3. In some cases the exception had occurred earlier, and we want to throw
> all such exceptions. For example failures caused by Java Agent, some java
> agents store such failures. During actual execution I want to throw all
> such exceptions.
>
> Basically any such scenarios where there are multiple causes for failure
> and I want to throw all of them.
>
> On Fri, Jul 17, 2020 at 10:06 PM sebb  wrote:
>
>> What is the use case for this?
>>
>> On Fri, 17 Jul 2020 at 16:29, Adwait Kumar Singh
>>  wrote:
>>> Yes Gary, something similar. However it would differ from IOExceptionList
>>> which creates an aggregated message of all exceptions but loses the
>>> stacktrace via getCause or printStackTrace.
>>>
>>> To be precise, this is exactly what I am taking about
>>>
>> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException
>> .
>>> <
>> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
>>>
>>> Created a JIRA issue 
>> for
>>> the same.
>>>
>>> <
>> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
>>>
>>> On Fri, Jul 17, 2020 at 8:44 PM Gary Gregory 
>> wrote:
 Would it be like Common IO's IOExceptionList or Commons DBCP
 SQLExceptionList ?

 Gary

 On Fri, Jul 17, 2020 at 11:01 AM Adwait Kumar Singh <
 theadvaitkumarsi...@gmail.com> wrote:

> To be more specific, I meant a util function in ExceptionUtils. Like
 this,
> ExceptionUtils.createCompositeException(String overallErrorMessage,
> Throwable... throwables)
>
> This would return a CompositeException which would contain all the
> Throwables and whose getCause() and printStackTrace() methods have
>> been
> overridden to given out a verbose cause and stacktrace which would
>> be an
> aggregation of the throwables supplied.
>
> Pardon me if this is not the correct platform or right mechanism to
 propose
> such changes. Please let me know the correct way to proceed.
>
> Thanks,
> Adwait.
>
> On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
> theadvaitkumarsi...@gmail.com> wrote:
>
>> Hi Commons devs,
>>
>> Use case : Ability to a single exceptions with multiple causes.
>> This
>> required in validation or initialization scenarios for example
>> when I
> want
>> to Validation/Initialization failures for multiple reasons and each
> reason
>> having a unique cause.
>> RxJava provides something similar
>> <
>> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
>> .
>>
>> Wanted to know if this makes sense, would raise a PR if it does.
>>
>> Thanks,
>> Adwait.
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: Proposal for creating a CompositeException in ExceptionUtils

2020-07-17 Thread Adwait Kumar Singh
Sample use cases:
1. Perform multiple operations, some failed due to different reasons.
Return a CompositeException for the failed ones.
2. Do a validation on some input. I want to collect all different failures,
I can throw a CompositeException.
3. In some cases the exception had occurred earlier, and we want to throw
all such exceptions. For example failures caused by Java Agent, some java
agents store such failures. During actual execution I want to throw all
such exceptions.

Basically any such scenarios where there are multiple causes for failure
and I want to throw all of them.

On Fri, Jul 17, 2020 at 10:06 PM sebb  wrote:

> What is the use case for this?
>
> On Fri, 17 Jul 2020 at 16:29, Adwait Kumar Singh
>  wrote:
> >
> > Yes Gary, something similar. However it would differ from IOExceptionList
> > which creates an aggregated message of all exceptions but loses the
> > stacktrace via getCause or printStackTrace.
> >
> > To be precise, this is exactly what I am taking about
> >
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException
> .
> > <
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> >
> >
> > Created a JIRA issue 
> for
> > the same.
> >
> > <
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> >
> >
> > On Fri, Jul 17, 2020 at 8:44 PM Gary Gregory 
> wrote:
> >
> > > Would it be like Common IO's IOExceptionList or Commons DBCP
> > > SQLExceptionList ?
> > >
> > > Gary
> > >
> > > On Fri, Jul 17, 2020 at 11:01 AM Adwait Kumar Singh <
> > > theadvaitkumarsi...@gmail.com> wrote:
> > >
> > > > To be more specific, I meant a util function in ExceptionUtils. Like
> > > this,
> > > >
> > > > ExceptionUtils.createCompositeException(String overallErrorMessage,
> > > > Throwable... throwables)
> > > >
> > > > This would return a CompositeException which would contain all the
> > > > Throwables and whose getCause() and printStackTrace() methods have
> been
> > > > overridden to given out a verbose cause and stacktrace which would
> be an
> > > > aggregation of the throwables supplied.
> > > >
> > > > Pardon me if this is not the correct platform or right mechanism to
> > > propose
> > > > such changes. Please let me know the correct way to proceed.
> > > >
> > > > Thanks,
> > > > Adwait.
> > > >
> > > > On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
> > > > theadvaitkumarsi...@gmail.com> wrote:
> > > >
> > > > > Hi Commons devs,
> > > > >
> > > > > Use case : Ability to a single exceptions with multiple causes.
> This
> > > > > required in validation or initialization scenarios for example
> when I
> > > > want
> > > > > to Validation/Initialization failures for multiple reasons and each
> > > > reason
> > > > > having a unique cause.
> > > > > RxJava provides something similar
> > > > > <
> > > >
> > >
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> > > > >
> > > > > .
> > > > >
> > > > > Wanted to know if this makes sense, would raise a PR if it does.
> > > > >
> > > > > Thanks,
> > > > > Adwait.
> > > > >
> > > >
> > >
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


Re: Proposal for creating a CompositeException in ExceptionUtils

2020-07-17 Thread sebb
What is the use case for this?

On Fri, 17 Jul 2020 at 16:29, Adwait Kumar Singh
 wrote:
>
> Yes Gary, something similar. However it would differ from IOExceptionList
> which creates an aggregated message of all exceptions but loses the
> stacktrace via getCause or printStackTrace.
>
> To be precise, this is exactly what I am taking about
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.
> 
>
> Created a JIRA issue  for
> the same.
>
> 
>
> On Fri, Jul 17, 2020 at 8:44 PM Gary Gregory  wrote:
>
> > Would it be like Common IO's IOExceptionList or Commons DBCP
> > SQLExceptionList ?
> >
> > Gary
> >
> > On Fri, Jul 17, 2020 at 11:01 AM Adwait Kumar Singh <
> > theadvaitkumarsi...@gmail.com> wrote:
> >
> > > To be more specific, I meant a util function in ExceptionUtils. Like
> > this,
> > >
> > > ExceptionUtils.createCompositeException(String overallErrorMessage,
> > > Throwable... throwables)
> > >
> > > This would return a CompositeException which would contain all the
> > > Throwables and whose getCause() and printStackTrace() methods have been
> > > overridden to given out a verbose cause and stacktrace which would be an
> > > aggregation of the throwables supplied.
> > >
> > > Pardon me if this is not the correct platform or right mechanism to
> > propose
> > > such changes. Please let me know the correct way to proceed.
> > >
> > > Thanks,
> > > Adwait.
> > >
> > > On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
> > > theadvaitkumarsi...@gmail.com> wrote:
> > >
> > > > Hi Commons devs,
> > > >
> > > > Use case : Ability to a single exceptions with multiple causes. This
> > > > required in validation or initialization scenarios for example when I
> > > want
> > > > to Validation/Initialization failures for multiple reasons and each
> > > reason
> > > > having a unique cause.
> > > > RxJava provides something similar
> > > > <
> > >
> > https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> > > >
> > > > .
> > > >
> > > > Wanted to know if this makes sense, would raise a PR if it does.
> > > >
> > > > Thanks,
> > > > Adwait.
> > > >
> > >
> >

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: Proposal for creating a CompositeException in ExceptionUtils

2020-07-17 Thread Adwait Kumar Singh
Yes Gary, something similar. However it would differ from IOExceptionList
which creates an aggregated message of all exceptions but loses the
stacktrace via getCause or printStackTrace.

To be precise, this is exactly what I am taking about
https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.


Created a JIRA issue  for
the same.



On Fri, Jul 17, 2020 at 8:44 PM Gary Gregory  wrote:

> Would it be like Common IO's IOExceptionList or Commons DBCP
> SQLExceptionList ?
>
> Gary
>
> On Fri, Jul 17, 2020 at 11:01 AM Adwait Kumar Singh <
> theadvaitkumarsi...@gmail.com> wrote:
>
> > To be more specific, I meant a util function in ExceptionUtils. Like
> this,
> >
> > ExceptionUtils.createCompositeException(String overallErrorMessage,
> > Throwable... throwables)
> >
> > This would return a CompositeException which would contain all the
> > Throwables and whose getCause() and printStackTrace() methods have been
> > overridden to given out a verbose cause and stacktrace which would be an
> > aggregation of the throwables supplied.
> >
> > Pardon me if this is not the correct platform or right mechanism to
> propose
> > such changes. Please let me know the correct way to proceed.
> >
> > Thanks,
> > Adwait.
> >
> > On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
> > theadvaitkumarsi...@gmail.com> wrote:
> >
> > > Hi Commons devs,
> > >
> > > Use case : Ability to a single exceptions with multiple causes. This
> > > required in validation or initialization scenarios for example when I
> > want
> > > to Validation/Initialization failures for multiple reasons and each
> > reason
> > > having a unique cause.
> > > RxJava provides something similar
> > > <
> >
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> > >
> > > .
> > >
> > > Wanted to know if this makes sense, would raise a PR if it does.
> > >
> > > Thanks,
> > > Adwait.
> > >
> >
>


Re: Proposal for creating a CompositeException in ExceptionUtils

2020-07-17 Thread Gary Gregory
Would it be like Common IO's IOExceptionList or Commons DBCP
SQLExceptionList ?

Gary

On Fri, Jul 17, 2020 at 11:01 AM Adwait Kumar Singh <
theadvaitkumarsi...@gmail.com> wrote:

> To be more specific, I meant a util function in ExceptionUtils. Like this,
>
> ExceptionUtils.createCompositeException(String overallErrorMessage,
> Throwable... throwables)
>
> This would return a CompositeException which would contain all the
> Throwables and whose getCause() and printStackTrace() methods have been
> overridden to given out a verbose cause and stacktrace which would be an
> aggregation of the throwables supplied.
>
> Pardon me if this is not the correct platform or right mechanism to propose
> such changes. Please let me know the correct way to proceed.
>
> Thanks,
> Adwait.
>
> On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
> theadvaitkumarsi...@gmail.com> wrote:
>
> > Hi Commons devs,
> >
> > Use case : Ability to a single exceptions with multiple causes. This
> > required in validation or initialization scenarios for example when I
> want
> > to Validation/Initialization failures for multiple reasons and each
> reason
> > having a unique cause.
> > RxJava provides something similar
> > <
> https://github.com/ReactiveX/RxJava/blob/3.x/src/main/java/io/reactivex/rxjava3/exceptions/CompositeException.java
> >
> > .
> >
> > Wanted to know if this makes sense, would raise a PR if it does.
> >
> > Thanks,
> > Adwait.
> >
>


Re: Proposal for creating a CompositeException in ExceptionUtils

2020-07-17 Thread Adwait Kumar Singh
To be more specific, I meant a util function in ExceptionUtils. Like this,

ExceptionUtils.createCompositeException(String overallErrorMessage,
Throwable... throwables)

This would return a CompositeException which would contain all the
Throwables and whose getCause() and printStackTrace() methods have been
overridden to given out a verbose cause and stacktrace which would be an
aggregation of the throwables supplied.

Pardon me if this is not the correct platform or right mechanism to propose
such changes. Please let me know the correct way to proceed.

Thanks,
Adwait.

On Fri, Jul 17, 2020 at 5:18 PM Adwait Kumar Singh <
theadvaitkumarsi...@gmail.com> wrote:

> Hi Commons devs,
>
> Use case : Ability to a single exceptions with multiple causes. This
> required in validation or initialization scenarios for example when I want
> to Validation/Initialization failures for multiple reasons and each reason
> having a unique cause.
> RxJava provides something similar
> 
> .
>
> Wanted to know if this makes sense, would raise a PR if it does.
>
> Thanks,
> Adwait.
>