Move a window to current desktop

I have a related post here: (OSX 10.11 (El Capitan) split view ? (I haven't succeeded yet)

It detects a window position, and proceeds from there. This would definitely return failure, if there’s no window.