Skip to content

suggestion on Exception Handling in MultipleJGitEnvironmentRepository #2161

@ndy2

Description

@ndy2

Is your feature request related to a problem? Please describe.
Hi! I'm newbie on spring config and frustrated by the 404 error on my config server
image

the error log is like no such label master

I google the error and the answer is like add default-label @ application.properties

spring.cloud.config.server.git.default-label= main

but it did not solve the problem.
Now I Found That default label is now main @ defulat
and the tryMaster feature was added due to maintain compatibility
related commit


above was my story of how i get to this suggestion.

I hope the method MultipleJGitEnvironmentRepository.findOne provide a little more kind log or exception handling
in blow lines

line 175

catch (Exception e) {
	if (MultipleJGitEnvironmentProperties.MAIN_LABEL.equals(label) && isTryMasterBranch()) {
		candidate = getRepository(this, application, profile, MultipleJGitEnvironmentProperties.MASTER_LABEL);
		return findOneFromCandidate(candidate, application, profile,
				MultipleJGitEnvironmentProperties.MASTER_LABEL, includeOrigin);
	}
	throw e;
}

if the error is catched and then it try again on master branch

if another error is throw while try on master branch.
it just eat the original exception which is thrown by first try (main branch) !!!

Describe the solution you'd like
A clear and concise description of what you want to happen.
I want to add simple log for original exception.

Additional context
the log i expected
image

i solve my problem and got to know actual exception by set

spring.cloud.config.server.git.try-master-branch: false

the log i got
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions