[
https://issues.apache.org/jira/browse/YUNIKORN-2262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17865345#comment-17865345
]
Wilfred Spiegelenburg commented on YUNIKORN-2262:
-------------------------------------------------
The join is a more generic way to handle it. It makes it really easy to use a
predefined error like "parent rule returned a leaf" or "queue not found" etc
and test for them. In other projects I have used similar constructs in test and
production code.
This is an example to check if the exit of a http server was a crash or a
normal shutdown:
{code:java}
if httpError != nil && !errors.Is(httpError, http.ErrServerClosed) {
log.Logger().Errorw("Failed to start web server", "error", httpError)
}
{code}
If you use the %w you would need to use string contains etc for these kinds of
checks. Really fragile, the slightest change can break that. Using the join
makes code readable and if we use predefined errors it will not break.
It also make checks in tests simple: did we really fail for the right reason or
did someone break the code and we failed unexpectedly
> propagate the error message when queue creation gets failed
> -----------------------------------------------------------
>
> Key: YUNIKORN-2262
> URL: https://issues.apache.org/jira/browse/YUNIKORN-2262
> Project: Apache YuniKorn
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: Chenchen Lai
> Priority: Minor
>
> [https://github.com/apache/yunikorn-core/blob/master/pkg/scheduler/partition.go#L334]
> the error message of root cause is swallowed, so it is hard to be inspired by
> the common message "failed to create rule based queue ..."
> BTW, the error I met is the parent queue "is already a leaf". The error
> message is helpful and it makes us catch up the root cause easily.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]