other/inca-xml2csv/trunk/src/net/sf/basedb/inca/ImportException.java

Code
Comments
Other
Rev Date Author Line
3883 27 Apr 16 nicklas 1 package net.sf.basedb.inca;
3883 27 Apr 16 nicklas 2
3883 27 Apr 16 nicklas 3 /**
3883 27 Apr 16 nicklas 4   Exception that we throw when importing data from a file.
3883 27 Apr 16 nicklas 5   Helps us with formatting an readable error message:
3883 27 Apr 16 nicklas 6   
3883 27 Apr 16 nicklas 7   File: {filename}
3883 27 Apr 16 nicklas 8   Line: {lineNo}
3883 27 Apr 16 nicklas 9   {Message}
3883 27 Apr 16 nicklas 10   
3883 27 Apr 16 nicklas 11   @author nicklas
3883 27 Apr 16 nicklas 12   @since 1.0
3883 27 Apr 16 nicklas 13 */
3883 27 Apr 16 nicklas 14 public class ImportException 
3883 27 Apr 16 nicklas 15   extends RuntimeException 
3883 27 Apr 16 nicklas 16 {
3883 27 Apr 16 nicklas 17
3883 27 Apr 16 nicklas 18   private static final long serialVersionUID = 5970762190423499472L;
3883 27 Apr 16 nicklas 19
3883 27 Apr 16 nicklas 20   /**
3883 27 Apr 16 nicklas 21     An error happened when parsing the file at the given line.
3883 27 Apr 16 nicklas 22   */
3883 27 Apr 16 nicklas 23   public ImportException(String filename, int line, String msg) 
3883 27 Apr 16 nicklas 24   {
3883 27 Apr 16 nicklas 25     super("File: " + filename + "\nLine: " + line + "\n" + msg);
3883 27 Apr 16 nicklas 26   }
3885 27 Apr 16 nicklas 27   
3885 27 Apr 16 nicklas 28   /**
3885 27 Apr 16 nicklas 29     An error happened when parsing the file at the given line.
3885 27 Apr 16 nicklas 30   */
3885 27 Apr 16 nicklas 31   public ImportException(String filename, int line, int rowNo, String msg) 
3885 27 Apr 16 nicklas 32   {
3885 27 Apr 16 nicklas 33     super("File: " + filename + "\nLine: " + line + "\n" + "<row> element: "+ rowNo + "\n" + msg);
3885 27 Apr 16 nicklas 34   }
3883 27 Apr 16 nicklas 35
3883 27 Apr 16 nicklas 36   /**
3883 27 Apr 16 nicklas 37     An error happened when parsing the file at the given line.
3883 27 Apr 16 nicklas 38   */
3883 27 Apr 16 nicklas 39   public ImportException(String filename, int line, Throwable cause) 
3883 27 Apr 16 nicklas 40   {
3883 27 Apr 16 nicklas 41     super("File: " + filename + "\nLine: " + line + "\n" + cause.getMessage(), cause);
3883 27 Apr 16 nicklas 42   }
3883 27 Apr 16 nicklas 43
3883 27 Apr 16 nicklas 44 }