1 /*
   2  * Copyright (c) 2002-2012, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jline.console;
  10 
  11 /**
  12  * This exception is thrown by {@link ConsoleReader#readLine} when
  13  * user interrupt handling is enabled and the user types the
  14  * interrupt character (ctrl-C). The partially entered line is
  15  * available via the {@link #getPartialLine()} method.
  16  */
  17 public class UserInterruptException
  18     extends RuntimeException
  19 {
  20     private final String partialLine;
  21 
  22     public UserInterruptException(String partialLine)
  23     {
  24         this.partialLine = partialLine;
  25     }
  26 
  27     /**
  28      * @return the partially entered line when ctrl-C was pressed
  29      */
  30     public String getPartialLine()
  31     {
  32         return partialLine;
  33     }
  34 }