Error Handling

This commit is contained in:
eltoncezar 2016-03-21 08:56:06 -03:00
parent 1c5f6899eb
commit c1dc2313cb

View File

@ -12,12 +12,19 @@ namespace SpotifyAPI.Local.Models
public string Type { get; internal set; } public string Type { get; internal set; }
public string Id { get; internal set; } public string Id { get; internal set; }
public SpotifyUri(string Uri) public SpotifyUri(string uri)
{ {
string[] props = Uri.Split(':'); if (String.IsNullOrEmpty(uri))
this.Base = props[0]; throw new ArgumentNullException("Uri");
this.Type = props[1];
this.Id = props[2]; string[] props = uri.Split(':');
if (props.Length != 3)
throw new ArgumentException("Unexpected Uri");
Base = props[0];
Type = props[1];
Id = props[2];
} }
} }
} }