Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save javierguerrero/52a6437cbcd6c18cfb849973ab99cb56 to your computer and use it in GitHub Desktop.
Save javierguerrero/52a6437cbcd6c18cfb849973ab99cb56 to your computer and use it in GitHub Desktop.
exception_handling_csharp_chapter5_9.cs
public async Task<string> ObtenerDatosAsync()
{
try
{
return await ClienteHttp.GetStringAsync("https://api.example.com/data");
}
catch (HttpRequestException ex)
{
Console.WriteLine("Error al obtener los datos: " + ex.Message);
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment