catch only executes if chrome.tabs.move() throws an error. Is this logging “Success.” in the console? If so then no error is occurring and the code in the catch block will never execute.
If an error is being thrown then the code in the catch block only executes if the if condition is true. You could add
console.log(error);
to the beginning of the catch block and then you would be able to verify that the catch executed if there was indeed an error. And you could also verify what the variable error actually contains to make sure it matches what you are expecting in the if statement.
thank you
I did that, and catch did not execute, chrome.tabs.move() does not always execute, and I get in browser’s extension tab, the same error that is listed in the catch
that is the problem
If the error in the catch is the exact string that the if statement is looking for then it just calls itself again in 50ms, so it should just keep trying until the error doesn’t occur. Without actually testing this I can’t really give you any useful help. I suppose you could copy the exact errors from the console into this thread so I could see them for myself.