On production it is possible to do the following:
new RoomPosition(12,12, 'roomname').getDirectionTo(12,12)
And it will return an undefined direction to move to.
It seems that on PTR this been changed which makes it throw an error now:
http://i.imgur.com/LitqPbx.png