Split up the 'Invalid translation language ($langcode) specified' exception in ContentEntityBase::addTranslation()

Created on 16 July 2023, over 1 year ago
Updated 20 July 2023, over 1 year ago

Problem/Motivation

The same exception is thrown for 3 different cases:

    if (!isset($this->languages[$langcode]) || $this->hasTranslation($langcode) || $this->languages[$langcode]->isLocked()) {
      throw new \InvalidArgumentException("Invalid translation language ($langcode) specified.");
    }

The exception message is fairly generic and vague, and because there are 3 different ways to get this, it's impossible to understand the problem.

This should be split into three separate checks, with different exception messages.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Entity 

Last updated about 1 hour ago

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024