Throws exception on unknown layer type.