/*
 * Copyright © 2020 Cask Data, Inc.
 *
 * 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.cdap.delta.api.assessment;

/**
 * Thrown when a table is unexpectedly not found.
 */
public class TableNotFoundException extends Exception {

  public TableNotFoundException(String database, String table, String errorMessage) {
    super(String.format("Table '%s' in database '%s' was not found. %s", table, database, errorMessage));
  }

  public TableNotFoundException(String database, String table, String errorMessage, Throwable cause) {
    super(String.format("Table '%s' in database '%s' was not found. %s", table, database, errorMessage), cause);
  }
}

@@ -630,16 +630,51 @@
 sment;%0A%0A
+import javax.annotation.Nullable;%0A%0A
 /**%0A * T
@@ -874,91 +874,373 @@
     
-super(String.format(%22Table '%25s' in database '%25s' was not found. %25s%22, table, databas
+this(database, null, table, errorMessage);%0A  %7D%0A%0A  public TableNotFoundException(String database, @Nullable String schema, String table, String errorMessage) %7B%0A    super(buildErrorMessage(database, schema, table, errorMessage));%0A  %7D%0A%0A  public TableNotFoundException(String database, String table, String errorMessage, Throwable cause) %7B%0A    this(database, null, tabl
 e, e
@@ -1242,33 +1242,39 @@
 le, errorMessage
-)
+, cause
 );%0A  %7D%0A%0A  public
@@ -1305,32 +1305,57 @@
 String database,
+ @Nullable String schema,
  String table, S
@@ -1365,32 +1365,36 @@
 ng errorMessage,
+%0A   
  Throwable cause
@@ -1407,16 +1407,312 @@
   super(
+buildErrorMessage(database, schema, table, errorMessage), cause);%0A  %7D%0A%0A  private static String buildErrorMessage(String database, @Nullable String schema, String table,%0A    String errorMessage) %7B%0A    String schemaInfo = schema == null ? %22%22 : String.format(%22and schema '%25s' %22, schema);%0A    return 
 String.f
@@ -1746,16 +1746,18 @@
 se '%25s' 
+%25s
 was not 
@@ -1784,16 +1784,28 @@
 atabase,
+ schemaInfo,
  errorMe
@@ -1806,28 +1806,20 @@
 rrorMessage)
-, cause)
 ;%0A  %7D%0A%7D%0A

add schema to TableNotFoundException (#106)