Send a server error (500) when an action fails.

Send error if action fails. Should fix #515.