Hello,
I'm uploading files to Azure using the c# sdk. When I run the DeviceClient.CompleteFileUploadAsync() method, I sometimes get a System.ArgumentException that has a couple of different of error codes and messages. The main ones I've seen are "Bad Request", "Expired correlationID", and "Invalid correlation ID".
Is there a way for me to see all of the error messages and codes for the API?
Also, I handle different messages in different ways. Which are more consistent, the error codes or the error messages? My worry is because these aren't part of the sdk and I'm catching them based on the actual text based error message, they're going to update and my app will break. Any advice on this?
Here's my code
try {
await deviceClient.CompleteFileUploadAsync(createUploadInfo(corrId), cancelToken);
}
catch (ArgumentException ex) {
if (ex.Message.Contains("Bad Request")) {
//do action
}
else if (ex.Message.Contains("Expired correlation ID")) {
//do another action
}
else if (ex.Message.Contains("Invalid correlation ID")) {
//do another action
}
//alert user of break
}`