New scenario YouTubeexception etc

This commit is contained in:
2019-01-09 23:23:56 +01:00
parent f455ac39ff
commit 5f7139c481
5 changed files with 62 additions and 9 deletions

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
namespace Exceptionhandling
{
public class YouTubeApi
{
public List<Video> GetVideos(string user)
{
try
{
// Access YouTube web interface
// Read the data
// Create a list of Video objects
throw new Exception("Ooops some low level YouTube error.");
}
catch (Exception ex)
{
//Log
throw new YouTubeException("Could not fetch the videos from YouTube.",ex);
}
return new List<Video>();
}
}
}