Error handling

Updated server side error handling