Skip to content

Handling network exceptions (Android) #195

@ncruces

Description

@ncruces

A request that fails on Android (due to a network error) is currently throwing a Java.Net.IOException, which (in Xamarin.Android) inherits directly from System.Exception.

This is unfortunate because the only way of dealing with this in a PCL is to catch every possible System.Exception, and use reflection from there (or IoC) since you obviously can't use the Java.* classes in a PCL.

I don't suggest ModernHttpClient marshals every exception, but maybe it makes sense to catch all Java.Lang.IOException here and marshal them into System.Net.WebException.
#153 seems related.

Don't know about iOS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions