private ChromelyResponse ExcuteRoute(RoutePath routePath, IDictionary <string, string> parameters, object postData, string requestId = null) { object result = null; var status = 200; var statusText = "OK"; try { var requestContext = GetRequestContext(routePath.Method, routePath.Path, requestId); var action = _actionBuilder.BuildAction(requestContext); var arguments = BindParameters(action, requestContext, parameters, postData); result = action.Invoke(arguments); } catch (RouteException re) { result = re.Message; status = 404; statusText = "Not Found"; } catch (Exception e) { result = e.Message; status = 500; statusText = "Server Error"; } return(new ChromelyResponse() { ReadyState = (int)ReadyState.ResponseIsReady, Status = status, StatusText = (string.IsNullOrWhiteSpace(statusText) && (status == (int)HttpStatusCode.OK)) ? "OK" : statusText, Data = result }); }