Skip to content

Commit f4da1e5

Browse files
author
Damian Zaremba
committed
Use an exception class with raising an exception
1 parent 65bcbad commit f4da1e5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/openbmp/api/parsed/message/Base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def parse(self, version, data):
5959
:return: True if error, False if no errors
6060
"""
6161
if not data.strip(): # If "data" is not string, throws error.
62-
raise "Invalid data!", data
62+
raise ValueError("Invalid data!", data)
6363

6464
self.spec_version = float(version)
6565

src/openbmp/api/parsed/message/Message.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, data):
2323
"""
2424

2525
if not data.strip(): # If "data" is not string, throws error.
26-
raise "Invalid data!", data
26+
raise ValueError("Invalid data!", data)
2727

2828
self.version = float()
2929
self.type = str()
@@ -101,4 +101,4 @@ def getContentPos(self):
101101
return self.content_pos
102102

103103
def getContent(self):
104-
return self.content
104+
return self.content

0 commit comments

Comments
 (0)