1 // Copyright 2020 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/quic/web_transport_error.h" 6 7 #include "base/strings/strcat.h" 8 9 namespace net { 10 WebTransportErrorToString(const WebTransportError & error)11std::string WebTransportErrorToString(const WebTransportError& error) { 12 std::string message = 13 ExtendedErrorToString(error.net_error, error.quic_error); 14 if (error.details == message) 15 return message; 16 return base::StrCat({message, " (", error.details, ")"}); 17 } 18 operator <<(std::ostream & os,const WebTransportError & error)19std::ostream& operator<<(std::ostream& os, const WebTransportError& error) { 20 os << WebTransportErrorToString(error); 21 return os; 22 } 23 24 } // namespace net 25