All Downloads are FREE. Search and download functionalities are using the official Maven repository.

stack.source.internal.DecoratedError Maven / Gradle / Ivy

There is a newer version: 0.4.2
Show newest version
package stack.source.internal;

import static java.lang.String.format;
import static java.util.Objects.requireNonNull;

public final class DecoratedError extends AssertionError {

    private final Throwable origin;

    public DecoratedError(Throwable origin) {
        // TODO handle failure
        super(new Decorator(origin).print());
        this.origin = requireNonNull(origin);
        setStackTrace(new StackTraceElement[0]);
    }

    public Throwable getOrigin() {
        return origin;
    }

    @Override
    public String toString() {
        return format("%s:%n%s", getClass().getName(), getLocalizedMessage());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy