• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 9907372175

12 Jul 2024 11:49AM UTC coverage: 61.142% (-0.02%) from 61.162%
9907372175

push

github

hohwille
fixed tests

1997 of 3595 branches covered (55.55%)

Branch coverage included in aggregate %.

5296 of 8333 relevant lines covered (63.55%)

2.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

27.27
cli/src/main/java/com/devonfw/tools/ide/cli/CliException.java
1
package com.devonfw.tools.ide.cli;
2

3
/**
4
 * {@link RuntimeException} for to abort CLI process in expected situations. It allows to abort with a defined message for the end user and a defined exit code.
5
 * Unlike other exceptions a {@link CliException} is not treated as technical error. Therefore by default (unless in debug mode) no stacktrace is printed.
6
 */
7
public class CliException extends RuntimeException {
8

9
  private final int exitCode;
10

11
  /**
12
   * The constructor.
13
   *
14
   * @param message the {@link #getMessage() message}.
15
   */
16
  public CliException(String message) {
17

18
    this(message, 1);
×
19
  }
×
20

21
  /**
22
   * The constructor.
23
   *
24
   * @param message the {@link #getMessage() message}.
25
   * @param cause the {@link #getCause() cause}.
26
   */
27
  public CliException(String message, Throwable cause) {
28

29
    this(message, 1, cause);
×
30
  }
×
31

32
  /**
33
   * The constructor.
34
   *
35
   * @param message the {@link #getMessage() message}.
36
   * @param exitCode the {@link #getExitCode() exit code}.
37
   */
38
  public CliException(String message, int exitCode) {
39

40
    super(message);
3✔
41
    this.exitCode = exitCode;
3✔
42
  }
1✔
43

44
  /**
45
   * The constructor.
46
   *
47
   * @param message the {@link #getMessage() message}.
48
   * @param exitCode the {@link #getExitCode() exit code}.
49
   * @param cause the {@link #getCause() cause}.
50
   */
51
  public CliException(String message, int exitCode, Throwable cause) {
52

53
    super(message, cause);
×
54
    this.exitCode = exitCode;
×
55
  }
×
56

57
  /**
58
   * @return the exit code. Should not be zero.
59
   */
60
  public int getExitCode() {
61

62
    return this.exitCode;
×
63
  }
64

65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc