0

I have an Apex call which causes an error (ENTITY_IS_DELETED, but it doesn't matter which error it is). I might be able to fix that error, but now it somehow also returns successfully anyway, so the client is confused.

Both the server and the client seem off, as follows.

// MyClass
public static void apexCall()
{
    // some code
    // --> generates error
    // return true; // -> Returns true anyways! This is the problem
}

In LWC, I call Apex. Now it catches the error, but then still proceeds to read the result anyway, which it shouldn't! It should stop.

console.log( '1' );

apexCall( { 
    var1: myVar
} ).then((result) =>
{
    console.log( '2 ' + result );

    // ..
))
.catch((error) =>
{
    log( 'x', this );

    console.error( error );
});

The log goes unexpectedly from the error to logging the new result (true):

1
x
2 true

1 Answer 1

0

It seems that there was an issue where the user was able to press the button twice, with calls conflicting each other. I implemented a way to disable the button until it completed its task.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.