Skip to content

ExecuteTaskAsync null response is causing an unhandled exception #466

@ghost

Description

I'm testing using my app offline by switching off my server. If I call ExecuteTaskAsync I'm getting an unhandled exception since the server is unavailable and the response is null.

The error arises in RestClient.Async.cs,

var async = ExecuteAsync(request, (response, _) =>
{
....
});

Would it make sense to handle the case where response is null e.g.

else if (response == null)
{
taskCompletionSource.TrySetException(new NullReferenceException());
}

or is there a better way this should be handled ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions