Skip to content

Commit

Permalink
Improved exception details when failing to load plugins. Updated Alba…
Browse files Browse the repository at this point in the history
….Framework submodule.
  • Loading branch information
Athari committed Dec 20, 2013
1 parent a677c94 commit 3039e18
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Alba.Framework
Submodule Alba.Framework updated 219 files
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Linq.Expressions;
using Alba.Framework.Collections;
using Alba.Framework.Linq;
using Alba.Framework.Reflection;

namespace Alba.XnaConvert.Common
{
Expand Down
4 changes: 2 additions & 2 deletions Alba.XnaConvert.Common/Loader/SelfServiceProvider.cs
@@ -1,5 +1,5 @@
using System;
using Alba.Framework.Sys;
using Alba.Framework.Reflection;
using Alba.Framework.Text;

namespace Alba.XnaConvert.Common
Expand All @@ -8,7 +8,7 @@ public class SelfServiceProvider : IServiceProvider
{
public object GetService (Type serviceType)
{
if (GetType().IsAssignableTo(serviceType))
if (GetType().Is(serviceType))
return this;
throw new InvalidOperationException("Service '{0}' not implemented.".Fmt(serviceType));
}
Expand Down
12 changes: 12 additions & 0 deletions Alba.XnaConvert/Program.cs
Expand Up @@ -5,6 +5,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Alba.Framework.Sys;
using Alba.Framework.Text;
using Alba.XnaConvert.CommandLine;
Expand All @@ -29,8 +30,19 @@ private static void Main (string[] args)
Console.WriteLine(e.Message);
Exit(1);
}
catch (ReflectionTypeLoadException e) {
Console.WriteLine("Failed to load one of plugins.");
Console.WriteLine(e.GetFullMessage());
Console.WriteLine("Detailed exception information:");
Console.WriteLine(e);
foreach (Exception ei in e.LoaderExceptions)
Console.WriteLine(ei);
Exit(1);
}
catch (Exception e) {
Console.WriteLine("Unexpected error!");
Console.WriteLine(e.GetFullMessage());
Console.WriteLine("Detailed exception information:");
Console.WriteLine(e);
Exit(1);
}
Expand Down

0 comments on commit 3039e18

Please sign in to comment.