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

leeonky / test-charm-java / 156

20 Mar 2025 01:53PM UTC coverage: 74.243% (-0.2%) from 74.475%
156

push

circleci

leeonky
Refactor

14 of 15 new or added lines in 12 files covered. (93.33%)

126 existing lines in 29 files now uncovered.

7947 of 10704 relevant lines covered (74.24%)

0.74 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
    @Deprecated
15
    public static <T> T opt1(Supplier<T> supplier) {
16
        try {
17
            return supplier.get();
1✔
18
        } catch (InterpreterException e) {
1✔
19
            throw e;
1✔
20
        } catch (Exception e) {
1✔
21
            throw exception(expression -> new DalException(expression.left().getOperandPosition(), e));
1✔
22
        }
23
    }
24

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

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

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

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

46
    abstract protected java.lang.RuntimeException thrower(DALExpression expression);
47

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

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

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

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