Ensure BuildErrors have FailureReason

Over in !5531 (merged) we tried to improve the granularity and correctness of job failure reasons. Specifically, in 524e0365, with asBuildError, we attempted to make failures in prepare and after_script stages have a failure reason of runner_system_failure. However, we missed the case where the called code returns a BuildError WITHOUT a FailureReason! Such a BuildError will be interpreted as/converted to a script_failure downstream, which is what we were trying to prevent.

Let's handle that case explicitly in asBuildError!

Merge request reports

Loading