Exceptions from errors in services.yml files should tell you which file

Created on 29 May 2022, about 2 years ago
Updated 6 February 2023, over 1 year ago

Problem/Motivation

When a services.yml file is badly-formed, doing a container rebuild just gives you an error with a snippet of the problem:

> A colon cannot be used in an unquoted mapping value at line 4 (near " - { name: route_enhancer }").

It doesn't tell you which file went wrong.

Steps to reproduce

Proposed resolution

DrupalKernel::compileContainer() should wrap calls to YamlFileLoader->load() with a try/catch block, and rethrow the exception with additional information about the filename.

This should be done in DrupalKernel rather than YamlFileLoader, as YamlFileLoader should be kept as close as possible to the Symfony version of that class that is is a fork of.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

10.1 ✨

Component
BaseΒ  β†’

Last updated 1 minute ago

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024