Better session insertion error handling.