Skip to content

Commit

Permalink
Added a better message than - The operation is not ready for invocati…
Browse files Browse the repository at this point in the history
…on. - like what and who
  • Loading branch information
Toby Henderson committed Dec 16, 2015
1 parent 30a942b commit cbe9eac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ public IEnumerable<T> FindAttributes<T>() where T : class
public IEnumerable<OutputMember> Invoke()
{
if (!Inputs.AllReady())
throw new InvalidOperationException("The operation is not ready for invocation.");
{
var notReady = Inputs.WhosNotReady();
throw new InvalidOperationException(string.Format("The operation {0} for {1} is not ready for invocation. These members are not ready; {2}", _method.Name, _method.Owner.Name, notReady.Select(x => x.Name).JoinString(", ")));
}

var handler = CreateInstance(_ownerType, Resolver);

Expand Down
9 changes: 8 additions & 1 deletion src/OpenRasta/OperationModel/OperationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Linq;

using OpenRasta.TypeSystem;

namespace OpenRasta.OperationModel
{
public static class OperationExtensions
Expand All @@ -10,7 +12,12 @@ public static bool AllReady(this IEnumerable<InputMember> members)
return members.All(x => x.IsReadyForAssignment);
}

/// <summary>
public static IEnumerable<IMember> WhosNotReady(this IEnumerable<InputMember> members)
{
return members.Where(x => x.IsReadyForAssignment == false).Select(x => x.Member);
}

/// <summary>
/// Returns the number of members ready for invocation (aka either having a default value or having had a value assigned to them).
/// </summary>
/// <param name="members"></param>
Expand Down

1 comment on commit cbe9eac

@holytshirt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better logging for issue #71

Please sign in to comment.