Return typed error when no candidate pairs

Returning a typed error allows us to handle it gracefully in
pions/webrtc
This commit is contained in:
Sean DuBois
2019-03-26 00:50:44 -07:00
parent 8b4aeeaa8d
commit 3580f6234f
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -796,7 +796,7 @@ func (a *Agent) getBestPair() (*candidatePair, error) {
out := <-res
if out == nil {
return nil, errors.New("no Valid Candidate Pairs Available")
return nil, ErrNoCandidatePairs
}
return out, nil
+3
View File
@@ -26,4 +26,7 @@ var (
// ErrClosed indicates the agent is closed
ErrClosed = errors.New("the agent is closed")
// ErrNoCandidatePairs indicates agent does not have a valid candidate pair
ErrNoCandidatePairs = errors.New("no candidate pairs available")
)