> So in my opinion it's a good thing that a TypeError exception is thrown when getLayerProperty is called while the layer does not exist.

I agree in principle. But doesn't that mean that to have correct behaviour, users of getLayerProperty need to wrap it in a try/catch block most of the time? (or call the existence function).