1414
1515import pipes
1616from .window import Window
17- from .exc import TmuxSessionExists
18- from . import util , formats
17+ from . import util , formats , exc
1918import logging
2019logger = logging .getLogger (__name__ )
2120
@@ -81,15 +80,15 @@ def attach_session(self, target_session=None):
8180 proc = self .tmux ('attach-session' , '-t%s' % self .get ('session_id' ))
8281
8382 if proc .stderr :
84- raise Exception (proc .stderr )
83+ raise exc . TmuxpException (proc .stderr )
8584
8685 def kill_session (self ):
8786 """``$ tmux kill-session``."""
8887
8988 proc = self .tmux ('kill-session' , '-t%s' % self .get ('session_id' ))
9089
9190 if proc .stderr :
92- raise Exception (proc .stderr )
91+ raise exc . TmuxpException (proc .stderr )
9392
9493 def switch_client (self , target_session = None ):
9594 """``$ tmux kill-session``.
@@ -101,7 +100,7 @@ def switch_client(self, target_session=None):
101100 proc = self .tmux ('switch-client' , '-t%s' % self .get ('session_id' ))
102101
103102 if proc .stderr :
104- raise Exception (proc .stderr )
103+ raise exc . TmuxpException (proc .stderr )
105104
106105 def rename_session (self , new_name ):
107106 """Rename session and return new :class:`Session` object.
@@ -119,7 +118,7 @@ def rename_session(self, new_name):
119118 )
120119
121120 if proc .stderr :
122- raise Exception (proc .stderr )
121+ raise exc . TmuxpException (proc .stderr )
123122
124123 return self
125124
@@ -182,7 +181,7 @@ def new_window(self,
182181 proc = self .tmux ('new-window' , * window_args )
183182
184183 if proc .stderr :
185- raise Exception (proc .stderr )
184+ raise exc . TmuxpException (proc .stderr )
186185
187186 window = proc .stdout [0 ]
188187
@@ -218,7 +217,7 @@ def kill_window(self, target_window=None):
218217 proc = self .tmux ('kill-window' , target )
219218
220219 if proc .stderr :
221- raise Exception (proc .stderr )
220+ raise exc . TmuxpException (proc .stderr )
222221
223222 self .server ._update_windows ()
224223
@@ -274,11 +273,11 @@ def attached_window(self):
274273 if len (active_windows ) == int (1 ):
275274 return active_windows [0 ]
276275 else :
277- raise Exception (
276+ raise exc . TmuxpException (
278277 'multiple active windows found. %s' % active_windows )
279278
280279 if len (self ._windows ) == int (0 ):
281- raise Exception ('No Windows' )
280+ raise exc . TmuxpException ('No Windows' )
282281
283282 def select_window (self , target_window ):
284283 """Return :class:`Window` selected via ``$ tmux select-window``.
@@ -297,7 +296,7 @@ def select_window(self, target_window):
297296 proc = self .tmux ('select-window' , target )
298297
299298 if proc .stderr :
300- raise Exception (proc .stderr )
299+ raise exc . TmuxpException (proc .stderr )
301300
302301 return self .attached_window ()
303302
0 commit comments