[go: up one dir, main page]

Skip to content

Import code strips out root causes and obscures where an error occurred

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem description

There is a design problem with our import/export code, and maybe something to keep in mind for future development: it is really hard currently to understand where errors occur, because on multiple occasions, we strip out root causes and propagate merely error messages. This completely obscures where an error occurred. For instance:

[4] pry(#<Gitlab::ImportExport::Importer>)> shared.errors
=> ["wrong number of arguments (given 1, expected 2)"]

This is not useful because there is no stacktrace attached; it happens because in several places we catch StandardError, then create a new exception from just the error message. This will attach a new stacktrace, so all errors appear to originate from the import service wrapper, which is not true. Errors should never have their root cause removed.

Proposed solution

  • When re-raising errors, make sure we propagate stack traces.
Edited by 🤖 GitLab Bot 🤖