Skip to content

Commit

Permalink
cleanup: shouldFail -> shouldThrow
Browse files Browse the repository at this point in the history
Signed-off-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
Cali0707 committed Jun 19, 2024
1 parent 62f1ee4 commit b70aecf
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package io.cloudevents.sql.impl;

import io.cloudevents.sql.EvaluationException;
import io.cloudevents.sql.ParseException;
import io.cloudevents.sql.Type;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.misc.Interval;
import org.antlr.v4.runtime.tree.ParseTree;

/**
* This class includes a list of static methods to create {@link io.cloudevents.sql.ParseException} and {@link io.cloudevents.sql.EvaluationException}.
*/
public class ExceptionFactoryImpl implements io.cloudevents.sql.ExceptionFactory {
private final boolean shouldFail;
private final boolean shouldThrow;

public ExceptionFactoryImpl(boolean shouldFail) {
this.shouldFail = shouldFail;
public ExceptionFactoryImpl(boolean shouldThrow) {
this.shouldThrow = shouldThrow;
}

public EvaluationException.EvaluationExceptionFactory invalidCastTarget(Class<?> from, Class<?> to) {
Expand All @@ -27,7 +23,7 @@ public EvaluationException.EvaluationExceptionFactory invalidCastTarget(Class<?>
null
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand All @@ -44,7 +40,7 @@ public EvaluationException.EvaluationExceptionFactory castError(Class<?> from, C
cause
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand All @@ -60,7 +56,7 @@ public EvaluationException missingAttribute(Interval interval, String expression
null
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand All @@ -75,7 +71,7 @@ public EvaluationException cannotDispatchFunction(Interval interval, String expr
cause
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand All @@ -91,7 +87,7 @@ public EvaluationException.EvaluationExceptionFactory functionExecutionError(Str
cause
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand All @@ -112,7 +108,7 @@ public EvaluationException mathError(Interval interval, String expression, Strin
null
);

if (this.shouldFail) {
if (this.shouldThrow) {
throw exception;
}
return exception;
Expand Down

0 comments on commit b70aecf

Please sign in to comment.