Actions
Patch #39207
closedReplace `YAML.load` with `YAML.load_file` in locales.rake and improve error reporting for invalid YAML files
Description
The attached patch replaces YAML.load
with YAML.load_file
in lib/tasks/locales.rake and improves the error message when `rake locales` fail to parse a translation file.
Suppose config/locales/tr.yml is not a valid YAML file and rake locales
raises an error. As shown in the example below, after the improvement, the name of the file containing the problem will be displayed instead of "<unknown>", making it easier to identify which file contains the problem.
Before:
Updating file ./config/locales/tr.yml rake aborted! Psych::SyntaxError: (<unknown>): did not find expected key while parsing a block mapping at line 7 column 3
After:
Updating file ./config/locales/tr.yml rake aborted! Psych::SyntaxError: (./config/locales/tr.yml): did not find expected key while parsing a block mapping at line 7 column 3
Files
Updated by Go MAEDA 10 months ago
- Subject changed from Use YAML.load_file instead of YAML.load to improve the error message of `rake locales` to Replace `YAML.load` with `YAML.load_file` in locales.rake and improve error reporting for invalid YAML files
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version set to 5.1.0
Committed the change in r22356.
Actions