1. Allow yourself to panic. Just metaphorically shit yourself. Please don't literally do that, because that will only make the situation worse. But don't try to suppress worry. Allow yourself a moment to freak out. Nobody is the calm, cool and collected traveler that they think or wish they were. I, for one, am really, really not and I let that flag fly.
2. Now you have to charge forward and handle the situation. Just put on your big girl/boy pants and deal with it. There's no magic formula because no two problems are ever entirely the same. Getting stranded with 5 friends at a rural train station in Southern Italy is not the same as not being able to get home from Amsterdam. Both of which I've had to deal with.
It's that simple and that complicated. Want an example?
Yesterday, I went to Hong Kong. It was meant to be a quick trip. But guess what? Despite my effort to buy a train ticket back ahead of time, there were no more train tickets. Not just for the next train. But for the whole day. And the whole night. For something like 18 hours, there were no available trains back to China. So I panicked. I mean, I let myself really flip out.
Then I had to pull it together. Running through the list of available options (buses, ferries, taxis,) I finally realized that I could put together a brilliant, albeit piecemeal, way home. I took a subway to the Chinese border and waltzed into a completely different city from the one I needed to be in. Then I took a train to another city. And from there, another train back to Foshan. A taxi home and a drink later, I realized that I just rocked that situation. My silly foreign ass navigated my way home. So I had another drink.
And there you have it. The reason this blog is named Trial and Error Travels. Whenever you travel, despite your very best efforts, something will go wrong. Let yourself panic and then embrace the chaos. You'll really be happy with yourself that you did.