Changelog API returns 500 when changelog configuration file has an invalid indentation
Summary
Changelog API returns 500 when the changelog configuration file has an invalid indentation, instead of a more user-friendly message. This makes the error much harder to troubleshoot. This was reported by a customer in one of our support tickets. Here's the feedback from the customer:
it would be very helpful if the API gave contextual information on the error, in this case a YAML formatting error.
Steps to reproduce
- Create a project
- Add a custom config file with the following (the last line is not indent correctly):
---
template: |
{% if categories %}
{% each categories %}
### {{ title }}
{% each entries %}
- [{{ title }}]({{ commit.reference }})\
{% if author.credit %} by {{ author.reference }}{% end %}
{% end %}
{% end %}
{% else %}
No changes.
{% end %}
- Make sure that your commits follow the correct syntax to generate Changelogs automatically
- Attempt to generate changelog data using the API
- The request should fail with a 500 error
What is the current bug behavior?
Changelog API returns 500 when changelog configuration file has an invalid indentation
What is the expected correct behavior?
Changelog API should fail with a more user-friendly message to make it easier to troubleshoot
Relevant logs and/or screenshots
- Relevant log file from Kibana: https://log.gprd.gitlab.net/app/discover#/doc/7092c4e2-4eb5-46f2-8305-a7da2edad090/pubsub-rails-inf-gprd-015057?id=v7WBDoYBneguPzSVR3VV
- Notice that the actual error message is displayed in the logs:
(<unknown>): found character that cannot start any token while scanning for the next token at line 16 column 2
- Notice that the actual error message is displayed in the logs:
Output of checks
This bug happens on GitLab.com
Possible fixes
Edited by Bruno Freitas