using System;
public class Program
{
public static void Main()
try
LoginUser();
}
catch(Exception ex)
Console.WriteLine("Log: " + ex.Message);
private static void LoginUser()
// Simulate API call
// Call fails with 401
// Response Body has user friendly message
throw new Exception("Unauthorized");
// simulate getting friendly message from response body
throw new Exception("You are not allowed, sorry");