aboutsummaryrefslogtreecommitdiffstats
path: root/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/OrchestrationException.java
blob: cf68cb55d5b321eb164a41a9a8db2303d28f0ed1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator;

import java.util.Arrays;

public class OrchestrationException extends RuntimeException {

    public OrchestrationException(Throwable cause) {
        super(cause);
    }

    public OrchestrationException(String message) {
        super(message);
    }

    public OrchestrationException(String message, Throwable cause) {
        super(message, cause);
    }

    // Overrides getMessage() to include suppressed Throwables, which is useful to see which
    // "resumes" of a failed suspend succeeded.
    @Override
    public String getMessage() {
        StringBuilder builder = new StringBuilder();
        builder.append(super.getMessage());
        Throwable[] suppressedThrowables = getSuppressed();
        Arrays.stream(suppressedThrowables).forEach(t -> builder.append("; With suppressed throwable " + t));
        return builder.toString();
    }

}