Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mavutil: Raise ValueError instead of exiting #931

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions mavutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,7 @@ class mavudp(mavfile):
def __init__(self, device, input=True, broadcast=False, source_system=255, source_component=0, use_native=default_native, timeout=0):
a = device.split(':')
if len(a) != 2:
print("UDP ports must be specified as host:port")
sys.exit(1)
raise ValueError("UDP ports must be specified as host:port")
self.port = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.udp_server = input
self.broadcast = False
Expand Down Expand Up @@ -1225,8 +1224,7 @@ def __init__(self,
use_native=default_native):
a = device.split(':')
if len(a) != 2:
print("TCP ports must be specified as host:port")
sys.exit(1)
raise ValueError("TCP ports must be specified as host:port")
self.destination_addr = (a[0], int(a[1]))

self.autoreconnect = autoreconnect
Expand Down Expand Up @@ -1321,8 +1319,7 @@ class mavtcpin(mavfile):
def __init__(self, device, source_system=255, source_component=0, retries=3, use_native=default_native):
a = device.split(':')
if len(a) != 2:
print("TCP ports must be specified as host:port")
sys.exit(1)
raise ValueError("TCP ports must be specified as host:port")
self.listen = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.listen_addr = (a[0], int(a[1]))
self.listen.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
Expand Down
Loading