You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no good way to handle exceptions from DelegateCommand. This is particularly problematic for DelegateCommand<T> where the framework (i.e. Xamarin.Forms) may send an invalid type by default. As there is no way to handle this it renders the DelegateCommand unusable.
API Changes
Update DelegateCommand to have both a Generic and non-Generic Catch method. In the event that an error is encountered we will internally catch the exception and either rethrow the exception if no delegate handler is provided, otherwise we will pass the exception to the provided handler.
MyCommand=new DelegateCommand(OnMyCommandExecuted).Catch<SomeException>(ex =>{// handler with ex cast as SomeException}).Catch(ex =>{// handler with generic Exception type})
Intended Use Case
This will generally help to allow the reuse of common code blocks for handling errors across multiple Commands.
The text was updated successfully, but these errors were encountered:
Summary
Currently there is no good way to handle exceptions from DelegateCommand. This is particularly problematic for
DelegateCommand<T>
where the framework (i.e. Xamarin.Forms) may send an invalid type by default. As there is no way to handle this it renders the DelegateCommand unusable.API Changes
Update DelegateCommand to have both a Generic and non-Generic
Catch
method. In the event that an error is encountered we will internally catch the exception and either rethrow the exception if no delegate handler is provided, otherwise we will pass the exception to the provided handler.Intended Use Case
This will generally help to allow the reuse of common code blocks for handling errors across multiple Commands.
The text was updated successfully, but these errors were encountered: