A confused sequence of events has led to a deeply angered Donald Trump and a shaky ceasefire between Israel and Iran.