server: change exceptions handling

Exceptions now make the program quit with the default configuration.
They are also print in JSON to be able to read them.