@@ -194,15 +194,15 @@ void WebRtcSessionDescriptionFactory::CreateOffer(
194194 std::string error = " CreateOffer" ;
195195 if (certificate_request_state_ == CERTIFICATE_FAILED) {
196196 error += kFailedDueToIdentityFailed ;
197- RTC_LOG (LS_ERROR) << error;
198- PostCreateSessionDescriptionFailed ( observer, error);
197+ PostCreateSessionDescriptionFailed (
198+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
199199 return ;
200200 }
201201
202202 if (!ValidMediaSessionOptions (session_options)) {
203203 error += " called with invalid session options" ;
204- RTC_LOG (LS_ERROR) << error;
205- PostCreateSessionDescriptionFailed ( observer, error);
204+ PostCreateSessionDescriptionFailed (
205+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
206206 return ;
207207 }
208208
@@ -223,27 +223,27 @@ void WebRtcSessionDescriptionFactory::CreateAnswer(
223223 std::string error = " CreateAnswer" ;
224224 if (certificate_request_state_ == CERTIFICATE_FAILED) {
225225 error += kFailedDueToIdentityFailed ;
226- RTC_LOG (LS_ERROR) << error;
227- PostCreateSessionDescriptionFailed ( observer, error);
226+ PostCreateSessionDescriptionFailed (
227+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
228228 return ;
229229 }
230230 if (!sdp_info_->remote_description ()) {
231231 error += " can't be called before SetRemoteDescription." ;
232- RTC_LOG (LS_ERROR) << error;
233- PostCreateSessionDescriptionFailed ( observer, error);
232+ PostCreateSessionDescriptionFailed (
233+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
234234 return ;
235235 }
236236 if (sdp_info_->remote_description ()->GetType () != SdpType::kOffer ) {
237237 error += " failed because remote_description is not an offer." ;
238- RTC_LOG (LS_ERROR) << error;
239- PostCreateSessionDescriptionFailed ( observer, error);
238+ PostCreateSessionDescriptionFailed (
239+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
240240 return ;
241241 }
242242
243243 if (!ValidMediaSessionOptions (session_options)) {
244244 error += " called with invalid session options." ;
245- RTC_LOG (LS_ERROR) << error;
246- PostCreateSessionDescriptionFailed ( observer, error);
245+ PostCreateSessionDescriptionFailed (
246+ observer, RTCError (RTCErrorType::INTERNAL_ERROR, std::move ( error)) );
247247 return ;
248248 }
249249
@@ -286,8 +286,9 @@ void WebRtcSessionDescriptionFactory::InternalCreateOffer(
286286 ? sdp_info_->local_description ()->description ()
287287 : nullptr );
288288 if (!desc) {
289- PostCreateSessionDescriptionFailed (request.observer .get (),
290- " Failed to initialize the offer." );
289+ PostCreateSessionDescriptionFailed (
290+ request.observer .get (), RTCError (RTCErrorType::INTERNAL_ERROR,
291+ " Failed to initialize the offer." ));
291292 return ;
292293 }
293294
@@ -348,8 +349,9 @@ void WebRtcSessionDescriptionFactory::InternalCreateAnswer(
348349 ? sdp_info_->local_description ()->description ()
349350 : nullptr );
350351 if (!desc) {
351- PostCreateSessionDescriptionFailed (request.observer .get (),
352- " Failed to initialize the answer." );
352+ PostCreateSessionDescriptionFailed (
353+ request.observer .get (), RTCError (RTCErrorType::INTERNAL_ERROR,
354+ " Failed to initialize the answer." ));
353355 return ;
354356 }
355357
@@ -387,24 +389,22 @@ void WebRtcSessionDescriptionFactory::FailPendingRequests(
387389 create_session_description_requests_.front ();
388390 PostCreateSessionDescriptionFailed (
389391 request.observer .get (),
390- ((request.type == CreateSessionDescriptionRequest::kOffer )
391- ? " CreateOffer"
392- : " CreateAnswer" ) +
393- reason);
392+ RTCError (RTCErrorType::INTERNAL_ERROR,
393+ ((request.type == CreateSessionDescriptionRequest::kOffer )
394+ ? " CreateOffer"
395+ : " CreateAnswer" ) +
396+ reason));
394397 create_session_description_requests_.pop ();
395398 }
396399}
397400
398401void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionFailed (
399402 CreateSessionDescriptionObserver* observer,
400- const std::string& error) {
403+ RTCError error) {
401404 Post ([observer =
402405 rtc::scoped_refptr<CreateSessionDescriptionObserver>(observer),
403- error]() mutable {
404- observer->OnFailure (
405- RTCError (RTCErrorType::INTERNAL_ERROR, std::move (error)));
406- });
407- RTC_LOG (LS_ERROR) << " Create SDP failed: " << error;
406+ error]() mutable { observer->OnFailure (error); });
407+ RTC_LOG (LS_ERROR) << " CreateSessionDescription failed: " << error.message ();
408408}
409409
410410void WebRtcSessionDescriptionFactory::PostCreateSessionDescriptionSucceeded (
0 commit comments