fix(cmd): return errors from PrintFormat in list and info commands - #1101
Open
TaichKarna wants to merge 1 commit into
Open
TaichKarna wants to merge 1 commit into
TaichKarna wants to merge 1 commit into
Conversation
Signed-off-by: TaichKarna <taichikarna@gmail.com>
TaichKarna
force-pushed
the
fix/return-output-format-errors
branch
from
September 14, 2026 18:11
be0e322 to
1a16997
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request ensures that formatting errors returned by
utils.PrintFormat()(e.g. when an invalid value is supplied to--output-format) are properly propagated by CobraRunEhandlers rather than swallowed.Previously, these commands used
log.Error(err)and returnednil, causing the CLI to log the error but exit with status code0. Returning the error ensures the CLI exits with a non-zero status code so shell scripts and CI/CD pipelines can detect execution failures.Type of Change
Please select the relevant type.
Changes
log.Error(err)withreturn erruponutils.PrintFormat()failures across:cmd/harbor/root/info.gocmd/harbor/root/labels/list.gocmd/harbor/root/registry/list.gocmd/harbor/root/repository/list.gocmd/harbor/root/user/list.go