Menu

1 / 3

My first GitLab contribution: teaching gitlab-shell to explain its own errors

DEV Community: gitlab·Koussay Mehdouani·about 3 hours ago
#N4aDvi4s
#devtogitlab#devto#dev#gitlab#error
Long article (677 words) — no AI summary yet.
Reading 0:00
15s threshold

Some error messages tell you exactly what went wrong. Others just shrug.

In gitlab-shell — the Go program that handles Git over SSH for GitLab — a failed JSON parse produced this, and only this:

parsing failed

Enter fullscreen mode

Exit fullscreen mode

No URL. No content type. Nothing about which request had just been parsed. If you were the operator staring at that log line, you knew something had failed and nothing else. Issue #888 in gitlab-shell asked for the obvious thing: when parsing fails, say what you were parsing.

I'm a high-school student in Tunisia, and that issue became my first contribution to GitLab.

The change

The fix itself is small. When the JSON parsing path in gitlab-shell fails now, it logs the request context before returning the error — the content type, and the URL it was talking to — using LabKit, GitLab's structured logging library.

One thing deliberately did not change: the returned error is still exactly parsing failed .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.