I am trying to initiate peer to peer connection in webrtc. I am using signalr as signaling server. I am getting error in all the browser when adding ice candidate. Below is the error and line of code. Please let me know how can i fix this.
Error in Firefox:
InvalidStateError: No remoteDescription.
Error in Chrome:
DOMException: Failed to execute 'addIceCandidate' on
'RTCPeerConnection': Error processing ICE candidate
Code:
if (signal.ice) {
console.log(signal.ice);
peerConnections.addIceCandidate(new RTCIceCandidate(signal.ice)).catch(errorHandler.message);
}
You don't need to build a new ice candidate object. Just adding signal.ice as ice candidate is enough. Here is the example from the official webrtc guide
signalingChannel.addEventListener('message', async message => {
if (message.iceCandidate) {
try {
await peerConnection.addIceCandidate(message.iceCandidate);
} catch (e) {
console.error('Error adding received ice candidate', e);
}
}
});
Related
I use fetch in try catch in Android webview, when the url has network issue or sslerror, I try to show the detailed error message about the reason, but the error only show "TypeError: Failed to fetch". Where to get the detailed error message?
Example code:
try {
await fetch("https://xxx");
} catch(error) {
console.log(error);
}
I am using the following code to send email for the logged in user.
await _graphClient.Me.SendMail(email, true).Request().PostAsync();
Initially it was executing be no email was sent. After poking around I figured out that a permission was not set. Unfortunately the try..catch around it was not tripped. My questions is if there is a way of detecting that an error occurred with this call.
Regarding
Unfortunately the try..catch around it was not tripped.
PostAsync() method should throw a ServiceException on error.
For example, in case of missing permissions:
try
{
await graphClient.Users[userId].SendMail(message).Request().PostAsync();
}
catch (Microsoft.Graph.ServiceException e)
{
Console.WriteLine(e.Error);
}
the following error should be printed:
Code: ErrorAccessDenied
Message: Access is denied. Check credentials and try again.
I am using braintree Drop-in UI with angularjs(frontend) and rails(Backend). I am creating a clientToken and sending it to braintree setup.
The client-token method,
#client_token = Braintree::ClientToken.generate(customer_id: current_user.braintree_customer_id,options: {
verify_card: true,
fail_on_duplicate_payment_method: true
})
So as you can see, I have taken 'fail_on_duplicate_payment_method' option. And trying to add the same payment method again.
Then, with that validation I am getting an error on the dropin saying "There was an error processing your request", but it is not coming to the error callback.
This is the setup, which is fine,
braintree.setup(vm.clientToken, 'dropin', {
container: 'dropin-container',
onPaymentMethodReceived: function(data)
{
alert('came recieved')
// console.log($scope.paymentForm)
vm.submit($scope.paymentForm, data.nonce)
},
onReady: function () {
vm.disablePay = false;
},
onError: function(type, message) {
alert('came error')
vm.serverError = message;
}
});
Here is the Image of the error,
The error in the network is,
callback_jsona7f3c885267b4f49aa13fbf01cecdb60({"error":{"message":"Credit card is invalid"},<br>"fieldErrors":[{"field":"creditCard","fieldErrors":[{"field":"number","code":"81724","message":"Duplicate card exists in the vault"}]}],"status":422})
I want to fetch this error into my view. I searched many links, but didn't get the answer I needed. Any help is appreciable.
Thankyou in Advance.
Full Disclosure: I work as a developer for Braintree
The onError callback is only triggered by client side errors and this is actually a server side error; however, the team is aware of this need and is working on a solution that will be available in a future release.
fetchUserRecordIDWithCompletionHandler returns:
<CKError 0x14daad30: "Server Rejected Request" (15/2001); "Request failed with http status code 500">
I have never seen this error with CloudKit. Do you think it is associated that some iCloud service was down nowadays?
defaultContainer.fetchUserRecordIDWithCompletionHandler({ _userRecordID, error in
if error == nil {
userRecordID = _userRecordID
loggedInUserRecordName = _userRecordID.recordName
dispatch_async(dispatch_get_main_queue(), {
self.progressView.setProgress(2 / self.steps, animated: true)
})
} else {
Utility.log("error 1231: \(error.localizedDescription)")
}
dispatch_semaphore_signal(self.sema)
})
Strange that fetchUserRecordIDWithCompletionHandler works in one of my other project with an other container, but usually does not work with this project with this container.
Any idea way?
Probably a server issue at the other end. 500 error code is unexpected internal error at server.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
This can happen when you are using wrong container. In my project I was using custom container that did not match default app container. Switching to correct one with custom identifier solved the issue.
Check the id of the CKContainer in Capabilities and your CKContainer's initialization make ensure that they are the same. In my case, I make this mistakeļ¼ and the error?.localizedDescription is Optional("Request failed with http status code 500")
Is there some way to reconnect to Pusher if any error or non-connected state is found?
Here's our connection code:
var pusher = new Pusher('<apikey>', {encrypted: true});
var state = pusher.connection.state;
pusher.connection.bind( 'error', function( err ) {
console.log(err);
});
pusher.connection.bind('state_change', function(states) {
// states = {previous: 'oldState', current: 'newState'}
console.log(states);
});
The Pusher JavaScript library automatically attempts reconnection. You don't need to add any code to support this.
I can't find this anywhere in the Pusher docs, but I know this for a fact as I worked for Pusher for 2 years.
You can test by going to http://test.pusher.com/ and disconnecting from the Internet and then reconnecting again. The logging will show it is auto-reconnecting.