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

devonfw / IDEasy / 12125578396

02 Dec 2024 06:25PM UTC coverage: 67.265% (+0.3%) from 67.008%
12125578396

push

github

web-flow
#824: fix git url with branch (#828)

2509 of 4080 branches covered (61.5%)

Branch coverage included in aggregate %.

6565 of 9410 relevant lines covered (69.77%)

3.08 hits per line

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

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

3
import com.devonfw.tools.ide.process.ProcessResult;
4

5
/**
6
 * {@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.
7
 * Unlike other exceptions a {@link CliException} is not treated as technical error. Therefore by default (unless in debug mode) no stacktrace is printed.
8
 */
9
public class CliException extends RuntimeException {
1✔
10

11
  private final int exitCode;
12

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

20
    this(message, 1);
4✔
21
  }
1✔
22

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

31
    this(message, 1, cause);
×
32
  }
×
33

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

42
    this(message, exitCode, null);
5✔
43
  }
1✔
44

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

54
    super(message, cause);
4✔
55
    assert (exitCode != ProcessResult.SUCCESS);
3!
56
    this.exitCode = exitCode;
3✔
57
  }
1✔
58

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

64
    return this.exitCode;
×
65
  }
66

67
}
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