[smuxi: 1/4] Frontend: enhanced exception messages of state machine



commit a204e6f9f5c6c6b33b4962c01bdcd006d9dd941b
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Aug 26 11:18:01 2014 +0200

    Frontend: enhanced exception messages of state machine

 src/Frontend/ChatViewSyncManager.cs |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/Frontend/ChatViewSyncManager.cs b/src/Frontend/ChatViewSyncManager.cs
index 3d4e1b7..40a5a6b 100644
--- a/src/Frontend/ChatViewSyncManager.cs
+++ b/src/Frontend/ChatViewSyncManager.cs
@@ -72,32 +72,50 @@ namespace Smuxi.Frontend
 
             public virtual void ExecuteAdd()
             {
-                throw new InvalidStateException("could not add in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not add in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
 
             public virtual void ExecuteRemove()
             {
-                throw new InvalidStateException("could not remove in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not remove in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
 
             public virtual void ExecuteRemoveFinished()
             {
-                throw new InvalidStateException("could not remove in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not finished remove in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
 
             public virtual void ExecuteSync()
             {
-                throw new InvalidStateException("could not sync in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not sync in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
 
             public virtual void ExecuteReadyToSync()
             {
-                throw new InvalidStateException("could not be ready to sync in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not be ready to sync in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
 
             public virtual void ExecuteSyncFinished()
             {
-                throw new InvalidStateException("could not finish sync in " + this.GetType().Name);
+                throw new InvalidStateException(
+                    String.Format("<{0}> could not finish sync in {1}",
+                                  SyncInfo.ChatModel, GetType().Name)
+                );
             }
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]