Add AbslStringify for RtcErrorType and RtcErrorDetail
Drive-by: fix MakeVal in rtc_base/checks.h to ensure that StrCat is used for types that have AbslStringify. Bug: None Change-Id: Ia78c65da18b4a826365a6a2c741f11809640197f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374345 Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43779}
This commit is contained in:
parent
a6bccab358
commit
32f3c6cef1
@ -105,6 +105,16 @@ enum class RTCErrorDetailType {
|
||||
RTC_EXPORT absl::string_view ToString(RTCErrorType error);
|
||||
RTC_EXPORT absl::string_view ToString(RTCErrorDetailType error);
|
||||
|
||||
template <typename Sink>
|
||||
void AbslStringify(Sink& sink, RTCErrorType error) {
|
||||
sink.Append(ToString(error));
|
||||
}
|
||||
|
||||
template <typename Sink>
|
||||
void AbslStringify(Sink& sink, RTCErrorDetailType error_detail) {
|
||||
sink.Append(ToString(error_detail));
|
||||
}
|
||||
|
||||
// Roughly corresponds to RTCError in the web api. Holds an error type, a
|
||||
// message, and possibly additional information specific to that error.
|
||||
//
|
||||
|
||||
@ -212,6 +212,7 @@ inline Val<CheckArgType::kVoidP, const void*> MakeVal(
|
||||
// The enum class types are not implicitly convertible to arithmetic types.
|
||||
template <typename T,
|
||||
absl::enable_if_t<std::is_enum<T>::value &&
|
||||
!absl::HasAbslStringify<T>::value &&
|
||||
!std::is_arithmetic<T>::value>* = nullptr>
|
||||
inline decltype(MakeVal(std::declval<absl::underlying_type_t<T>>())) MakeVal(
|
||||
T x) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user