Skip to content

Commit

Permalink
Reword send exceptions for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Oct 1, 2024
1 parent 4bf08fd commit 99fca9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/impl/datachannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion src/impl/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99fca9a

Please sign in to comment.