> What will return layers[id][prop] return when id does not exist in layers. Will it throw an exception?

Yes. Try `({}).a.b` in a debugger console. You will get a `TypeError` exception.

>How are users of the function supposed to react?

I think the user should make sure that the layer identifier by `id` exists prior to calling getLayerProperty. getLayerProperty is not responsible for reporting on the existence of the layer.

> I think that having to call another function every time before calling this function is cumbersome (ok, sometimes checking for existence might be omitted, but with our flexible layers definition based on topic, I don't think that's the normal use case)

I fully agree. 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.