1 /* $RCSfile$
2  * $Author: hansonr $
3  * $Date: 2015-08-30 23:43:59 -0500 (Sun, 30 Aug 2015) $
4  * $Revision: 20747 $
5  *
6  * Copyright (C) 2005  The Jmol Development Team
7  *
8  * Contact: jmol-developers@lists.sf.net
9  *
10  *  This library is free software; you can redistribute it and/or
11  *  modify it under the terms of the GNU Lesser General Public
12  *  License as published by the Free Software Foundation; either
13  *  version 2.1 of the License, or (at your option) any later version.
14  *
15  *  This library is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *  Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 package org.jmol.smiles;
26 
27 /**
28  * Exception thrown for invalid SMILES String
29  */
30 public class InvalidSmilesException extends Exception {
31 
32   private static String lastError;
33 
getLastError()34   public static String getLastError() {
35     return lastError;
36   }
37 
clear()38   public static void clear() {
39     lastError = null;
40   }
41 
42   @Override
getMessage()43   public String getMessage() {
44     return lastError;
45   }
46   /**
47    * Constructs a <code>InvalidSmilesException</code> with a detail message.
48    *
49    * @param message The detail message.
50    */
InvalidSmilesException(String message)51   public InvalidSmilesException(String message) {
52     super(message);
53     lastError = (message.startsWith("Jmol SMILES") ? message : "Jmol SMILES Exception: " +  message);
54   }
55 
56 }
57