private bool handleErrorMessage(object[] errorMessage, int[] exceptedErrorCodes)
{
List<TLErrorMessage> errs = decodeErrors(errorMessage);
if (errs.Count > 0) {
foreach (TLErrorMessage foundError in errs) {
bool matched = exceptedErrorCodes.Any(exceptedErrorCode => foundError.code == exceptedErrorCode);
/*
List<TLErrorMessage> errs = decodeErrors(errorMessage);
if (errs.Count > 0)
{
foreach (TLErrorMessage foundError in errs)
{
bool matched = false;
foreach (int exceptedErrorCode in exceptedErrorCodes)
if (foundError.code == exceptedErrorCode)
{
matched = true;
break;
}
// all must match or we throw an exception
if (!matched)
{
string msg = string.Format("{0}:{1}", errs[0].code, errs[0].message);
throw new TestLinkException(msg, errs);
}
}
return true;
// we have matched the errors to the exceptions
}
return false;
// there were no errors
*/
// all must match or we throw an exception
if (!matched) {
string msg = string.Format("{0}:{1}", errs[0].code, errs[0].message);
throw new TestLinkException(msg, errs);
}
}
return true;
// we have matched the errors to the exceptions
}
return false;
// there were no errors
}