Adding error handle to Segmment model