Browse Source

Reword send exceptions for clarity

Paul-Louis Ageneau 10 months ago
parent
commit
99fca9ad1c
2 changed files with 5 additions and 2 deletions
  1. 4 1
      src/impl/datachannel.cpp
  2. 1 1
      src/impl/track.cpp

+ 4 - 1
src/impl/datachannel.cpp

@@ -185,9 +185,12 @@ bool DataChannel::outgoing(message_ptr message) {
 		std::shared_lock lock(mMutex);
 		transport = mSctpTransport.lock();
 
-		if (!transport || mIsClosed)
+		if (mIsClosed)
 			throw std::runtime_error("DataChannel is closed");
 
+		if (!transport)
+			throw std::runtime_error("DataChannel not open");
+
 		if (!mStream.has_value())
 			throw std::logic_error("DataChannel has no stream assigned");
 

+ 1 - 1
src/impl/track.cpp

@@ -202,7 +202,7 @@ bool Track::transportSend([[maybe_unused]] message_ptr message) {
 		std::shared_lock lock(mMutex);
 		transport = mDtlsSrtpTransport.lock();
 		if (!transport)
-			throw std::runtime_error("Track is closed");
+			throw std::runtime_error("Track is not open");
 
 		// Set recommended medium-priority DSCP value
 		// See https://www.rfc-editor.org/rfc/rfc8837.html#section-5