/[xmltv_parser]/trunk/xmltv_parser/main.cs
ViewVC logotype

Diff of /trunk/xmltv_parser/main.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/xmltv_parser/main.cs	2013/03/10 10:34:07	100
+++ trunk/xmltv_parser/main.cs	2013/03/10 10:36:47	101
@@ -178,17 +178,21 @@
                 var id = program.MetaData[XMLTVConstants.Programs.ProgramChannelId].ToString();
                 Channel = instance.Channels.Find(m => m.Id == id);
                 //ListViewItem li = new ListViewItem(string.Format("{0} {1}", Channel.Number, Channel.CallSign));
-                if (Channel.MetaData.Count() == 0) { throw new ArgumentOutOfRangeException(string.Format("No metadata available for channel id: {0}", Channel.Id)); }
+                if (Channel == null)
+                {
+                    throw new NullReferenceException(string.Format("Could not find any channel with an id of '{0}'", id));
+                }
+                if (Channel.MetaData.Count() == 0) { throw new ArgumentOutOfRangeException(string.Format("No metadata available for channel id '{0}'", Channel.Id)); }
                 var channel_names = Channel.MetaData[XMLTVConstants.Channels.ChannelDisplayName];
                 string channel_name = string.Empty;
-                if (channel_names.Count() == 0) { throw new ArgumentOutOfRangeException(string.Format("No properties named '{0}' found for channel id: {1}", XMLTVConstants.Channels.ChannelDisplayName, Channel.Id)); }
+                if (channel_names.Count() == 0) { throw new ArgumentOutOfRangeException(string.Format("No properties named '{0}' found for channel id '{1}'", XMLTVConstants.Channels.ChannelDisplayName, Channel.Id)); }
                 else
                 {
                     var channame = channel_names.FirstOrDefault();
-                    if (channame == null) { throw new NullReferenceException(string.Format("Unable to get channel display name for channel id: {0}", Channel.Id)); }
+                    if (channame == null) { throw new ArgumentNullException("channame", string.Format("Unable to get channel display name for channel id '{0}'", Channel.Id)); }
                     else
                     {
-                        if (channame.Value == null) { throw new NullReferenceException(string.Format("Unable to get channel display name for channel id: {0}", Channel.Id)); }
+                        if (channame.Value == null) { throw new ArgumentNullException("channame.Value", string.Format("Unable to get channel display name for channel id '{0}'", Channel.Id)); }
                         else { channel_name = channame.Value.ToString(); }
                     }
                 }

 

  ViewVC Help
Powered by ViewVC 1.1.22