Skip to content

Commit

Permalink
Merge pull request reactiveui#840 from bradtwurst/master
Browse files Browse the repository at this point in the history
Improve error exception logging
  • Loading branch information
anaisbetts committed Apr 23, 2015
2 parents 09c92a8 + 5468bc5 commit 9532a8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ReactiveUI/PropertyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ IDisposable bindToDirect<TTarget, TValue>(
return This.Subscribe(
x => setter(target, x, viewExpression.GetArgumentsArray()),
ex => {
this.Log().ErrorException("Binding recieved an Exception!", ex);
this.Log().ErrorException(String.Format("{0} Binding received an Exception!", viewExpression), ex);
if (fallbackValue != null) setter(target, fallbackValue(), null);
});
}
Expand All @@ -955,7 +955,7 @@ IDisposable bindToDirect<TTarget, TValue>(
.Subscribe(
x => setter(x.host, x.val, viewExpression.GetArgumentsArray()),
ex => {
this.Log().ErrorException("Binding recieved an Exception!", ex);
this.Log().ErrorException(String.Format("{0} Binding received an Exception!", viewExpression), ex);
if (fallbackValue != null) setter(target, fallbackValue(), viewExpression.GetArgumentsArray());
});
}
Expand Down
6 changes: 6 additions & 0 deletions ReactiveUI/Xaml/WpfDependencyObjectObservableForProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.ComponentModel;
using System.Reactive.Linq;
using System.Reactive.Disposables;
using Splat;

namespace ReactiveUI
{
Expand All @@ -25,6 +26,11 @@ public IObservable<IObservedChange<object, object>> GetNotificationForProperty(o
var propertyName = expression.GetMemberInfo().Name;
var dpd = DependencyPropertyDescriptor.FromProperty(getDependencyProperty(type, propertyName), type);

if (dpd == null) {
this.Log().Error("Couldn't find dependency property " + propertyName + " on " + type.Name);
throw new NullReferenceException("Couldn't find dependency property " + propertyName + " on " + type.Name);
}

return Observable.Create<IObservedChange<object, object>>(subj => {
var handler = new EventHandler((o, e) => {
subj.OnNext(new ObservedChange<object, object>(sender, expression));
Expand Down

0 comments on commit 9532a8d

Please sign in to comment.