Example #1
0
	public static void Err(ILogSource loggr, RestServiceException ex)
	{
		bool showInnerException = true;
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.NotAcceptable:
				msg = "Invalid JSON object format.";
				showInnerException = false;
				break;

			case HttpStatusCode.Conflict:
				msg = "Value already exists in the database.";
				break;

			case HttpStatusCode.BadRequest:
				msg = "Unrecognized data fields.";
				break;

			case HttpStatusCode.Forbidden:
				var usr = ex.InnerException.Message.Between("Access denied for user ", ").", true);
				msg = "{0} is not allowed to create new nodes.".f(usr.Quotify());
				showInnerException = false;
				break;
		}

		OnAnyEvent.Error(loggr, ex, msg, showInnerException);
	}
Example #2
0
	public static void Err(ILogSource loggr, RestServiceException ex)
	{
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.InternalServerError:
				msg = "TODO: make this specific";
				break;
		}

		OnAnyEvent.Error(loggr, ex, msg);
	}
Example #3
0
	public static void Err(ILogSource loggr, RestServiceException ex)
	{
		bool showInnerException = true;
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.NotFound:
				msg = "Requested node does not exist on the server.";
				showInnerException = false;
				break;
		}

		OnAnyEvent.Error(loggr, ex, msg, showInnerException);
	}
Example #4
0
	public static bool Err(ILogSource loggr, RestServiceException ex)
	{
		bool showInnerException = true;
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.NotFound:
				msg = "Resource not found:  " + ex.BaseUrl.Slash(ex.Resource);
				showInnerException = false;
				break;			
		}

		OnAnyEvent.Error(loggr, ex, msg, showInnerException);
		return false;
	}
Example #5
0
	public static bool Err(ILogSource loggr, RestServiceException ex)
	{
		bool showInnerException = true;
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.BadRequest:
				msg = "Invalid field values.";
				showInnerException = false;
				break;
		}

		OnAnyEvent.Error(loggr, ex, msg, showInnerException);
		return false;
	}
Example #6
0
        public static bool Err(ILogSource loggr, RestServiceException ex)
        {
            bool showInnerException = true;
            string msg = ""; switch (ex.Code)
            {
                case HttpStatusCode.Unused:
                    var usr = ex.InnerException.Message.Between("Access denied for user ", ").", true);
                    msg = "{0} is not allowed to delete this node.".f(usr.Quotify());
                    showInnerException = false;
                    break;
            }

            OnAnyEvent.Error(loggr, ex, msg, showInnerException);
            return false;
        }
Example #7
0
	public static void Err(ILogSource loggr, RestServiceException ex)
	{
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.Forbidden:
				msg = "SSL certificate is invalid.";
				break;
				
			case HttpStatusCode.ServiceUnavailable:
				msg = "Unable to reach the server."; 
				break;
			
			case HttpStatusCode.Unauthorized:
				msg = "Server rejected application credentials.";
				break;
		}
		
		OnAnyEvent.Error(loggr, ex, msg);
	}
Example #8
0
	public static bool Err(ILogSource loggr, RestServiceException ex)
	{
		bool showInnerException = true;
		string msg = ""; switch (ex.Code)
		{
			case HttpStatusCode.NotAcceptable:
				msg = "Invalid JSON object format.";
				showInnerException = false;
				break;
			
			case HttpStatusCode.Forbidden:
				var usr = ex.InnerException.Message.Between("Access denied for user ", ").", true);
				msg = "{0} is not allowed to edit this node.".f(usr.Quotify());
				showInnerException = false;
				break;
		}

		OnAnyEvent.Error(loggr, ex, msg, showInnerException);
		return false;
	}