001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.nbio.ontology.utils; 022 023/** 024 * An unchecked exception representing an Assertion failure. 025 * 026 * <p>Assertion failures should be raised when code finds itself in a state that 027 * should be impossible. It should not be raised in response to any predictable 028 * error condition. Assertion failures indicate that something has gone 029 * badly wrong, and that the assumptions under which library code has been 030 * developed are not holding.</p> 031 * 032 * <p>This extends {@link java.lang.AssertionError}, adding convenient 033 * constructors with messages and causes.</p> 034 * 035 * 036 * Your application may exit due to one of these being thrown. This usualy 037 * indicates that something is badly wrong with library code. It should never 038 * be raised in response to invalid arguments to methods, or incorrectly 039 * formatted data. It is not your fault. Report the error to the mailing list, 040 * or who ever else is responsible for the library code you are using. 041 * 042 * 043 * Under some rare circumstances, you may wish to catch assertion failures. For 044 * example, when debugging library code, or when the success or failure of an 045 * opperation is utterly inconsequential. Ignoring assertion failures 046 * out-of-hand is a sure-fire way to make your code buggy. 047 * 048 * 049 * Raise AssertionFailure in your code when something that should be impossible 050 * has happened. For example, if you have checked the alphabet of a symbol list 051 * you are working with, and somewhere further down an IllegalSymbolException 052 * is raised, then this is an assertion failure. 053 * 054 * @author Matthew Pocock 055 * @since 1.4 056 */ 057public class AssertionFailure 058extends AssertionError { 059 public AssertionFailure(String message) { 060 super(message); 061 } 062 063 public AssertionFailure(Throwable cause) { 064 initCause(cause); 065 } 066 067 public AssertionFailure(String message, Throwable cause) { 068 this(message); 069 initCause(cause); 070 } 071}