Chaned raised  error type and message formatting