New scenario YouTubeexception etc
This commit is contained in:
28
Exceptionhandling/YouTubeApi.cs
Normal file
28
Exceptionhandling/YouTubeApi.cs
Normal 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>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user