001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.util.struct; 006 007public class BadSchemaException extends Exception { 008 private final String m_field; 009 010 public BadSchemaException(String s) { 011 super(s); 012 m_field = ""; 013 } 014 015 public BadSchemaException(String message, Throwable cause) { 016 super(message, cause); 017 m_field = ""; 018 } 019 020 public BadSchemaException(Throwable cause) { 021 super(cause); 022 m_field = ""; 023 } 024 025 public BadSchemaException(String field, String s) { 026 super(s); 027 m_field = field; 028 } 029 030 public BadSchemaException(String field, String message, Throwable cause) { 031 super(message, cause); 032 m_field = field; 033 } 034 035 public String getField() { 036 return m_field; 037 } 038 039 @Override 040 public String toString() { 041 return m_field.isEmpty() ? getMessage() : "field " + m_field + ": " + getMessage(); 042 } 043}