Well you could wrap your entire custom task in a try/catch block to at least catch the error.
So what logic are you using in your code that does something with an "uri property".
probably you something like
Uri myURL = new Uri(myUrlProperty);
where the value of
myUrlProperty is invalid.