cli/command/task: taskContext.Error(): use ellipsis utility

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-11-28 16:22:54 +01:00
parent 0ed80a3a58
commit 2c41bbc49f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 3 additions and 3 deletions

View File

@ -123,11 +123,11 @@ func (c *taskContext) CurrentState() string {
func (c *taskContext) Error() string {
// Trim and quote the error message.
taskErr := c.task.Status.Err
if c.trunc && len(taskErr) > maxErrLength {
taskErr = fmt.Sprintf("%s…", taskErr[:maxErrLength-1])
if c.trunc {
taskErr = formatter.Ellipsis(taskErr, maxErrLength)
}
if len(taskErr) > 0 {
taskErr = fmt.Sprintf("\"%s\"", taskErr)
taskErr = fmt.Sprintf(`"%s"`, taskErr)
}
return taskErr
}