Skip to content

Commit

Permalink
Console-ui example: catch UserInterruptException in place of IOError
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jan 31, 2025
1 parent de0a14a commit decdc13
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, the original author(s).
* Copyright (c) 2024-2025, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -8,7 +8,6 @@
*/
package org.jline.consoleui.examples;

import java.io.IOError;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -21,6 +20,7 @@
import org.jline.consoleui.prompt.builder.PromptBuilder;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.reader.UserInterruptException;
import org.jline.reader.impl.completer.StringsCompleter;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
Expand Down Expand Up @@ -109,7 +109,7 @@ public static void main(String[] args) {
System.out.println("We will deliver the order in 5 minutes");
}
}
} catch (IOError e) {
} catch (UserInterruptException e) {
System.out.println("<ctrl>-c pressed");
} catch (Exception e) {
System.out.println(e.getMessage());
Expand Down

0 comments on commit decdc13

Please sign in to comment.