Process error handling

This is an important step towards logging