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

leeonky / test-charm-java / 159

21 Mar 2025 03:45PM UTC coverage: 71.297% (-2.9%) from 74.243%
159

push

circleci

leeonky
Update remark and exclamation api

12 of 13 new or added lines in 5 files covered. (92.31%)

8 existing lines in 2 files now uncovered.

6801 of 9539 relevant lines covered (71.3%)

0.83 hits per line

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

94.12
/DAL-java/src/main/java/com/github/leeonky/dal/runtime/ExpressionException.java
1
package com.github.leeonky.dal.runtime;
2

3
import com.github.leeonky.dal.ast.node.DALExpression;
4
import com.github.leeonky.interpreter.InterpreterException;
5

6
import java.util.function.Function;
7
import java.util.function.Predicate;
8
import java.util.function.Supplier;
9

10
import static com.github.leeonky.dal.runtime.DalException.locateError;
11

12
//TODO check all exception
13
public abstract class ExpressionException extends java.lang.RuntimeException {
1✔
14
    public static <T> T opt1(Supplier<T> supplier) {
15
        try {
16
            return supplier.get();
1✔
17
        } catch (InterpreterException e) {
1✔
18
            throw e;
1✔
19
        } catch (Exception e) {
1✔
20
            throw exception(expression -> new DalException(expression.left().getOperandPosition(), e));
1✔
21
        }
22
    }
23

24
    public static Predicate<Data.Resolved> testOpt1(Predicate<Data.Resolved> test) {
25
        return r -> opt1(() -> test.test(r));
1✔
26
    }
27

28
    public static <T> T opt2(Supplier<T> supplier) {
29
        try {
30
            return supplier.get();
1✔
31
        } catch (Exception e) {
1✔
32
            throw exception(expression -> new DalException(expression.right().getOperandPosition(), e));
1✔
33
        }
34
    }
35

36
    public static Supplier<Throwable> locatedError(String message, int position) {
37
        return () -> locateError(new DalRuntimeException(message), position);
1✔
38
    }
39

40
    public java.lang.RuntimeException rethrow(DALExpression expression) {
41
        return thrower(expression);
1✔
42
    }
43

44
    abstract protected java.lang.RuntimeException thrower(DALExpression expression);
45

46
    public static ExpressionException exception(Function<DALExpression, java.lang.RuntimeException> thrower) {
47
        return new ExpressionException() {
1✔
48
            @Override
49
            protected java.lang.RuntimeException thrower(DALExpression expression) {
50
                return thrower.apply(expression);
1✔
51
            }
52
        };
53
    }
54

55
    public static ExpressionException illegalOperation(String message) {
56
        return exception(expression -> new DalException(message, expression.operator().getPosition()));
1✔
57
    }
58

59
    public static ExpressionException illegalOp2(String message) {
60
        return exception(expression -> new DalException(message, expression.right().getOperandPosition()));
1✔
61
    }
62

63
    public static ExpressionException illegalOp1(String message) {
UNCOV
64
        return exception(expression -> new DalException(message, expression.left().getOperandPosition()));
×
65
    }
66
}
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

© 2026 Coveralls, Inc