Added try/catch #5427

Nit: the indentation is incorrect here (and below).