How to get the current teach pendant tab?

Hello,
I have a problem when trying to prompt the operator to teach a position.

Here is the code:
apiProvider.getUserInterfaceAPI().getUserInteraction().getUserDefinedRobotPosition(
new RobotPositionCallback2() {

@Override
public void onOk(PositionParameters parameters) {
	System.out.println(parameters.getPose());
}

});

If the teach pendant is on the “Run” tab, this doesn’t work and instead writes an error in the console like this:

11:19:06.432 ERROR - Could not switch card. Unable to find card: com.ur.move.MoveTab. Currently in card: com.ur.polyscope.logging.internal.TimeCounterWidget[,0,0,400x250,layout=javax.swing.BoxLayout,alignmentX=0.0,alignmentY=0.0,border=com.ur.swing.g5.CardBorder@5fcc9354,flags=9,maximumSize=,minimumSize=,preferredSize=]. {thread: Thread-48 , loggerClass: com.ur.swing.SwitchSupport}

I tried to wrap the code with a try catch statement, but it doesn’t “throw” the error, it just prints it.
My idea is to display a popup informing the operator to switch to a different tab if this happens.

Is there a way to catch this error or preemptively check on which tab is the teach pendant currently?

Thanks!

Hi, has anyone encountered this issue? It’s happening when prompted from a Toolbar URCap.