/*
 * Copyright (C) 2015-2018 SoftIndex LLC.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.datakernel.exception;

import io.datakernel.annotation.Nullable;

/**
 * This exception (as well as its subtypes) is used in asynchronous contexts
 * where the default Java call stacktrace has no useful meaning and is redundant
 * to fetch, store or print.
 */

public class StacklessException extends Exception {
	private final Class<?> component;

	public StacklessException() {
		super();
		this.component = null;
	}

	public StacklessException(String message) {
		super(message);
		this.component = null;
	}

	public StacklessException(String message, Throwable cause) {
		super(message, cause);
		this.component = null;
	}

	public StacklessException(Throwable cause) {
		super(cause);
		this.component = null;
	}

	public StacklessException(Class<?> component, String message) {
		super(message);
		this.component = component;
	}

	public StacklessException(Class<?> component, String message, Throwable cause) {
		super(message, cause);
		this.component = component;
	}

	@Nullable
	public Class<?> getComponent() {
		return component;
	}

	@Override
	public final Throwable fillInStackTrace() {
		return component == null ? super.fillInStackTrace() : this;
	}

	@Override
	public String toString() {
		return getClass().getName() +
				(component != null ? " (" + component.getSimpleName() + ")" : "") + " : " +
				getMessage();
	}
}

@@ -1017,35 +1017,63 @@
 mponent = null;%0A
+%09%09super.fillInStackTrace();%0A
 %09%7D%0A
-
 %0A%09public Stackle
@@ -1137,32 +1137,60 @@
 mponent = null;%0A
+%09%09super.fillInStackTrace();%0A
 %09%7D%0A%0A%09public Stac
@@ -1281,32 +1281,60 @@
 mponent = null;%0A
+%09%09super.fillInStackTrace();%0A
 %09%7D%0A%0A%09public Stac
@@ -1408,16 +1408,44 @@
 = null;%0A
+%09%09super.fillInStackTrace();%0A
 %09%7D%0A%0A%09pub
@@ -1819,32 +1819,32 @@
 ckTrace() %7B%0A
+
 %09%09return
  component =
@@ -1835,55 +1835,8 @@
 turn
- component == null ? super.fillInStackTrace() :
  thi

Fix StacklessException's stack trace filling