Skip to content

Commit 2f7a1bb

Browse files
committed
Add new class for MI exceptions
1 parent be669cf commit 2f7a1bb

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

opensips/mi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
## along with this program. If not, see <http://www.gnu.org/licenses/>.
1818
##
1919

20-
from .wrapper import MI
20+
from .connector import MI, OpenSIPSMIException
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
from .connection import HTTP, Datagram, FIFO
2121
from .jsonrpc_helper import JSONRPCError, JSONRPCException
2222

23+
class OpenSIPSMIException(Exception):
24+
pass
25+
2326
class MI():
2427
def __init__(self, conn: str, **kwargs):
2528
if conn == "fifo":
@@ -37,9 +40,9 @@ def execute(self, cmd, params=[]):
3740
try:
3841
ret_val = self.conn.execute(cmd, params)
3942
except JSONRPCError as e:
40-
raise Exception("Error executing command: {}".format(e))
43+
raise OpenSIPSMIException("Error executing command: {}".format(e))
4144
except JSONRPCException as e:
42-
raise Exception("Error with connection: {}. Is OpenSIPS running?".format(e))
45+
raise OpenSIPSMIException("Error with connection: {}. Is OpenSIPS running?".format(e))
4346
return ret_val
4447

4548
def valid(self):

0 commit comments

Comments
 (0)