/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.server.model;

import com.google.common.base.Throwables;
import io.spine.base.Error;
import io.spine.base.ErrorVBuilder;
import io.spine.type.TypeUrl;

import static java.lang.String.format;

/**
 * An exception thrown when a {@link io.spine.client.Query Query} targets an unknown entity type.
 */
public final class UnknownEntityTypeException extends RuntimeException {

    public UnknownEntityTypeException(TypeUrl type) {
        super(format("Type `%s` does not belong to any known bounded context.", type));
    }

    /**
     * Converts this exception into an {@link Error}.
     */
    public Error asError() {
        String stackTrace = Throwables.getStackTraceAsString(this);
        return ErrorVBuilder
                .newBuilder()
                .setMessage(getMessage())
                .setStacktrace(stackTrace)
                .setType(UnknownEntityTypeException.class.getName())
                .build();
    }
}

@@ -1042,114 +1042,8 @@
 l;%0A%0A
-import com.google.common.base.Throwables;%0Aimport io.spine.base.Error;%0Aimport io.spine.base.ErrorVBuilder;%0A
 impo
@@ -1440,420 +1440,7 @@
    %7D
-%0A%0A    /**%0A     * Converts this exception into an %7B@link Error%7D.%0A     */%0A    public Error asError() %7B%0A        String stackTrace = Throwables.getStackTraceAsString(this);%0A        return ErrorVBuilder%0A                .newBuilder()%0A                .setMessage(getMessage())%0A                .setStacktrace(stackTrace)%0A                .setType(UnknownEntityTypeException.class.getName())%0A                .build();%0A    %7D
 %0A%7D%0A

Delete unused method.