The problem is when the layer cannot be drawn. I've jammed in bad urls for a layer that I'm adding for testing purposes. My layer shows in the HTML list but I'll get an alerted error message after a few seconds that the layer was unable to be drawn.
What I'd like to do is still add to my HTML list, but add some CSS (red strike through) to note that there was a problem with that particular layer. What's my best bet? Should I use a deferred promise on the function that adds the layer to the map so that I have a call back method to change the CSS?
I ask because I feel like I'm over thinking this. The drawing/adding of a layer on the map looks async so my other code continues and is done by the time I get the alert/error from ESRI.