Skip to content

Commit

Permalink
Use Java Exception instead of BError
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinperera00 committed Dec 10, 2024
1 parent 08131a6 commit 9a7b611
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
package io.ballerina.runtime.internal;

import io.ballerina.runtime.api.Future;
import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.utils.StringUtils;
import io.ballerina.runtime.internal.scheduling.Strand;
import io.ballerina.runtime.internal.values.MapValueImpl;

import java.util.concurrent.atomic.AtomicBoolean;

Expand All @@ -43,8 +39,7 @@ public BalFuture(Strand strand) {
@Override
public void complete(Object returnValue) {
if (visited.getAndSet(true)) {
throw ErrorCreator.createError(StringUtils.fromString("cannot complete the same future twice."),
new MapValueImpl<>(PredefinedTypes.TYPE_ERROR_DETAIL));
throw new IllegalStateException("cannot complete the same future twice.");

Check warning on line 42 in bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/BalFuture.java

View check run for this annotation

Codecov / codecov/patch

bvm/ballerina-runtime/src/main/java/io/ballerina/runtime/internal/BalFuture.java#L42

Added line #L42 was not covered by tests
}
strand.returnValue = returnValue;
strand.scheduler.unblockStrand(strand);
Expand Down

0 comments on commit 9a7b611

Please sign in to comment.