Created
October 28, 2024 20:13
-
-
Save javierguerrero/52a6437cbcd6c18cfb849973ab99cb56 to your computer and use it in GitHub Desktop.
exception_handling_csharp_chapter5_9.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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