throw new InvalidOperationException("Invalid instance (object may have been disposed or release)");
}
- if (err == MessagesError.InvalidParameter)
+ switch (err)
{
- throw new ArgumentException(err.ToString());
- }
- else if (err == MessagesError.NotSupported)
- {
- throw new NotSupportedException("Not supported");
- }
- else
- {
- throw new InvalidOperationException(err.ToString());
+ case MessagesError.OutOfMemory:
+ throw new OutOfMemoryException(err.ToString());
+ case MessagesError.InvalidParameter:
+ throw new ArgumentException(err.ToString());
+ case MessagesError.PermissionDenied:
+ throw new UnauthorizedAccessException(err.ToString());
+ case MessagesError.NotSupported:
+ throw new NotSupportedException(err.ToString());
+ default:
+ throw new InvalidOperationException(err.ToString());
}
}
}
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
/// <exception cref="NotSupportedException">Thrown when message service is not supported</exception>
/// <exception cref="ArgumentException">Thrown when input coordinates are invalid</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public static Task<SentResult> SendMessageAsync(Message message, bool saveToSentbox)
{
return MessagesManagerImpl.Instance.SendMessageAsync(message, saveToSentbox);
/// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
/// <exception cref="NotSupportedException">Thrown when message service is not supported</exception>
/// <exception cref="ArgumentException">Thrown when input coordinates are invalid</exception>
+ /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when application does not have proper privileges</exception>
public static Task<IEnumerable<Message>> SearchMessageAsync(MessagesSearchFilter filter)
{
return MessagesManagerImpl.Instance.SearchMessageAsync(filter);