Not sure if they still do it, but in the old days anytime a CO lost a ship, no matter what the circumstances, there was a courts martial. Often it was pro-forma, especially in wartime. But the Navy did not want anybody thinking the loss of a ship would be treated lightly.
The obvious exception being Lt. J.G. John F. Kennedy, although I suppose very few skippers in the Navy (then and now) have Joe Kennedy's connections.