Instead of throwing an exception, return false if the layer can't be added to the map. r=bbinet,tschaub