public static ErrorType GetErrorType(MetacoErrorResult result)
        {
            if (result == null)
            {
                return ErrorType.UnknownError;
            }

            var type = FromString(result.MetacoError);
            if (type == ErrorType.Undefined)
            {
                if (result.Status == 404)
                {
                    type = ErrorType.NotFound;
                }
                else if (result.Status == 401)
                {
                    type = ErrorType.Unauthorized;
                }
                else if (result.Status >= 500 && result.Status < 600)
                {
                    type = ErrorType.ServerError;
                }
                else
                {
                    return ErrorType.UnknownError;
                }
            }
            return type;
        }
 public MetacoClientException(MetacoErrorResult errorResult, ErrorType errorType, string content, int statusCode, Exception inner)
     : base(string.Format("Metaco API failed with \"{0}\". {1}", errorResult.Message, (inner!=null ? "See inner exception": "")), inner)
 {
     this.MetacoError = errorResult;
     this.ErrorType = errorType;
     this.Content = content;
     this.StatusCode = statusCode;
 }
 public MetacoClientException(MetacoErrorResult errorResult, ErrorType errorType, string content, int statusCode)
     : this(errorResult, errorType, content, statusCode, null)
 {
 }