diff --git a/RestSharp.MonoDroid/Extensions/ResponseStatusExtensions.cs b/RestSharp.MonoDroid/Extensions/ResponseStatusExtensions.cs
new file mode 100644
index 000000000..e04bdf3a9
--- /dev/null
+++ b/RestSharp.MonoDroid/Extensions/ResponseStatusExtensions.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Net;
+
+namespace RestSharp.Extensions
+{
+ public static class ResponseStatusExtensions
+ {
+ ///
+ /// Convert a to a instance.
+ ///
+ /// The response status.
+ ///
+ /// responseStatus
+ public static WebException ToWebException(this ResponseStatus responseStatus)
+ {
+ switch (responseStatus)
+ {
+ case ResponseStatus.None:
+ return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation);
+ case ResponseStatus.Error:
+ return new WebException("An error occured while processing the request.", WebExceptionStatus.ServerProtocolViolation);
+ case ResponseStatus.TimedOut:
+ return new WebException("The request timed-out.", WebExceptionStatus.Timeout);
+ case ResponseStatus.Aborted:
+ return new WebException("The request was aborted.", WebExceptionStatus.Timeout);
+ default:
+ throw new ArgumentOutOfRangeException("responseStatus");
+ }
+ }
+ }
+}
diff --git a/RestSharp.MonoDroid/RestSharp.MonoDroid.csproj b/RestSharp.MonoDroid/RestSharp.MonoDroid.csproj
index 780f305e3..2b5db6f4e 100644
--- a/RestSharp.MonoDroid/RestSharp.MonoDroid.csproj
+++ b/RestSharp.MonoDroid/RestSharp.MonoDroid.csproj
@@ -254,6 +254,7 @@
SharedAssemblyInfo.cs
+
diff --git a/RestSharp.MonoTouch/Extensions/ResponseStatusExtensions.cs b/RestSharp.MonoTouch/Extensions/ResponseStatusExtensions.cs
new file mode 100644
index 000000000..e04bdf3a9
--- /dev/null
+++ b/RestSharp.MonoTouch/Extensions/ResponseStatusExtensions.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Net;
+
+namespace RestSharp.Extensions
+{
+ public static class ResponseStatusExtensions
+ {
+ ///
+ /// Convert a to a instance.
+ ///
+ /// The response status.
+ ///
+ /// responseStatus
+ public static WebException ToWebException(this ResponseStatus responseStatus)
+ {
+ switch (responseStatus)
+ {
+ case ResponseStatus.None:
+ return new WebException("The request could not be processed.", WebExceptionStatus.ServerProtocolViolation);
+ case ResponseStatus.Error:
+ return new WebException("An error occured while processing the request.", WebExceptionStatus.ServerProtocolViolation);
+ case ResponseStatus.TimedOut:
+ return new WebException("The request timed-out.", WebExceptionStatus.Timeout);
+ case ResponseStatus.Aborted:
+ return new WebException("The request was aborted.", WebExceptionStatus.Timeout);
+ default:
+ throw new ArgumentOutOfRangeException("responseStatus");
+ }
+ }
+ }
+}
diff --git a/RestSharp.MonoTouch/RestSharp.MonoTouch.csproj b/RestSharp.MonoTouch/RestSharp.MonoTouch.csproj
index b56fa5856..be8ecf814 100644
--- a/RestSharp.MonoTouch/RestSharp.MonoTouch.csproj
+++ b/RestSharp.MonoTouch/RestSharp.MonoTouch.csproj
@@ -303,6 +303,7 @@
SharedAssemblyInfo.cs
+
\ No newline at end of file
diff --git a/RestSharp/IRestClient.cs b/RestSharp/IRestClient.cs
index 77010f317..8dcc0e2c5 100644
--- a/RestSharp/IRestClient.cs
+++ b/RestSharp/IRestClient.cs
@@ -18,7 +18,7 @@
using System.Net;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
-#if NET4
+#if NET4 || MONODROID || MONOTOUCH
using System.Threading;
using System.Threading.Tasks;
#endif
@@ -123,7 +123,7 @@ public interface IRestClient
IRestResponse ExecuteAsPost(IRestRequest request, string httpMethod) where T : new();
#endif
-#if NET4
+#if NET4 || MONODROID || MONOTOUCH
///
/// Executes the request and callback asynchronously, authenticating if needed
///
diff --git a/RestSharp/RestClient.Async.cs b/RestSharp/RestClient.Async.cs
index 6b57128fa..ce19f7054 100644
--- a/RestSharp/RestClient.Async.cs
+++ b/RestSharp/RestClient.Async.cs
@@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
-#if NET4
+#if NET4 || MONODROID || MONOTOUCH
using System.Threading.Tasks;
#endif
using System.Text;
@@ -158,7 +158,7 @@ private void DeserializeResponse(IRestRequest request, Action
/// Executes a GET-style request asynchronously, authenticating if needed
///