File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
32using System . Text ;
43using Shuttle . Core . Contract ;
54
65namespace Shuttle . Core . Reflection
76{
87 public static class ExceptionExtensions
98 {
9+ public static T Find < T > ( this Exception ex ) where T : Exception
10+ {
11+ var enumerator = ex ;
12+
13+ while ( enumerator != null )
14+ {
15+ if ( enumerator is T result )
16+ {
17+ return result ;
18+ }
19+
20+ enumerator = enumerator . InnerException ;
21+ }
22+
23+ return null ;
24+ }
25+
26+ public static bool Contains < T > ( this Exception ex ) where T : Exception
27+ {
28+ return ex . Find < T > ( ) != null ;
29+ }
30+
1031 public static string AllMessages ( this Exception ex )
1132 {
1233 var messages = new StringBuilder ( ) ;
Original file line number Diff line number Diff line change 3333[ assembly: AssemblyTitle ( ".NET Standard 2.0" ) ]
3434#endif
3535
36- [ assembly: AssemblyVersion ( "10.0.9 .0" ) ]
36+ [ assembly: AssemblyVersion ( "10.0.10 .0" ) ]
3737[ assembly: AssemblyCopyright ( "Copyright © Eben Roux 2017" ) ]
3838[ assembly: AssemblyProduct ( "Shuttle.Core.Reflection" ) ]
3939[ assembly: AssemblyCompany ( "Shuttle" ) ]
4040[ assembly: AssemblyConfiguration ( "Release" ) ]
41- [ assembly: AssemblyInformationalVersion ( "10.0.9 " ) ]
41+ [ assembly: AssemblyInformationalVersion ( "10.0.10 " ) ]
4242[ assembly: ComVisible ( false ) ]
You can’t perform that action at this time.
0 commit comments