-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a4cf9c
commit 8400862
Showing
2 changed files
with
17 additions
and
4 deletions.
There are no files selected for viewing
19 changes: 16 additions & 3 deletions
19
src/FakeXrmEasy.Core/Exceptions/FindReflectedTypeException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Text; | ||
|
||
namespace FakeXrmEasy.Core.Exceptions | ||
{ | ||
/// <summary> | ||
/// Exception raised when the generated early bound types have an unsupported format | ||
/// </summary> | ||
public class FindReflectedTypeException : Exception | ||
{ | ||
/// <summary> | ||
/// Default constructor | ||
/// </summary> | ||
/// <param name="message"></param> | ||
public FindReflectedTypeException(string message) : base(message) | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Creates a FindReflectedException from a ReflectionTypeLoadException | ||
/// </summary> | ||
/// <param name="reflectionTypeLoadException"></param> | ||
/// <returns></returns> | ||
public static FindReflectedTypeException New(ReflectionTypeLoadException reflectionTypeLoadException) | ||
{ | ||
// now look at ex.LoaderExceptions - this is an Exception[], so: | ||
var s = ""; | ||
var s = new StringBuilder(); | ||
foreach (var innerException in reflectionTypeLoadException.LoaderExceptions) | ||
{ | ||
// write details of "inner", in particular inner.Message | ||
s += innerException.Message + " "; | ||
s.AppendLine(innerException.Message); | ||
} | ||
|
||
return new FindReflectedTypeException("XrmFakedContext.FindReflectedType: " + s); | ||
return new FindReflectedTypeException("XrmFakedContext.FindReflectedType: " + s.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters