@@ -2,6 +2,7 @@ package session
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
5
6
"runtime/pprof"
6
7
"strconv"
7
8
@@ -87,7 +88,7 @@ func (s *Session) handleCommand(
87
88
return s .handleSelectedCommand (ctx , tag , cmd , ch , profiler )
88
89
89
90
default :
90
- panic ("bad command" )
91
+ return fmt . Errorf ("bad command" )
91
92
}
92
93
}
93
94
@@ -121,7 +122,7 @@ func (s *Session) handleAnyCommand(
121
122
return s .handleIDGet (ctx , tag , ch )
122
123
123
124
default :
124
- panic ("bad command" )
125
+ return fmt . Errorf ("bad command" )
125
126
}
126
127
}
127
128
@@ -144,7 +145,7 @@ func (s *Session) handleNotAuthenticatedCommand(
144
145
return s .handleLogin (ctx , tag , cmd .GetLogin (), ch )
145
146
146
147
default :
147
- panic ("bad command" )
148
+ return fmt . Errorf ("bad command" )
148
149
}
149
150
}
150
151
@@ -230,7 +231,7 @@ func (s *Session) handleAuthenticatedCommand(
230
231
return s .handleAppend (ctx , tag , cmd .GetAppend (), ch )
231
232
232
233
default :
233
- panic ("bad command" )
234
+ return fmt . Errorf ("bad command" )
234
235
}
235
236
}
236
237
@@ -336,6 +337,6 @@ func (s *Session) handleWithMailbox(
336
337
return s .handleMove (ctx , tag , cmd .GetMove (), mailbox , ch )
337
338
338
339
default :
339
- panic ("bad command" )
340
+ return fmt . Errorf ("bad command" )
340
341
}
341
342
}
0 commit comments