{"action":"created","issue":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1401","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1401/labels{/name}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1401/comments","events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1401/events","html_url":"https://github.com/phoenixframework/phoenix/pull/1401","id":121545855,"number":1401,"title":"feat(Phoenix.Router.Helpers): better errors on path helpers","user":{"login":"Gazler","id":477511,"avatar_url":"https://avatars.githubusercontent.com/u/477511?v=3","gravatar_id":"","url":"https://api.github.com/users/Gazler","html_url":"https://github.com/Gazler","followers_url":"https://api.github.com/users/Gazler/followers","following_url":"https://api.github.com/users/Gazler/following{/other_user}","gists_url":"https://api.github.com/users/Gazler/gists{/gist_id}","starred_url":"https://api.github.com/users/Gazler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gazler/subscriptions","organizations_url":"https://api.github.com/users/Gazler/orgs","repos_url":"https://api.github.com/users/Gazler/repos","events_url":"https://api.github.com/users/Gazler/events{/privacy}","received_events_url":"https://api.github.com/users/Gazler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-10T18:12:07Z","updated_at":"2016-01-01T17:07:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/1401","html_url":"https://github.com/phoenixframework/phoenix/pull/1401","diff_url":"https://github.com/phoenixframework/phoenix/pull/1401.diff","patch_url":"https://github.com/phoenixframework/phoenix/pull/1401.patch"},"body":"Instead of simply returning an error when passing an atom to a route\r\nhelper that hasn't been defined, the error now prompts the user to input\r\na defined route instead.\r\n\r\nPreviously an `UndefinedFunctionError` was raised.\r\n\r\nNow an `ArgumentError` is raised with the following message:\r\n\r\n    No route helper clause for MyApp.Router.Helpers.foo_path/2 defined\r\n    for action :skip.\r\n    The following foo_path/2 actions are defined under your router:\r\n\r\n     * :file\r\n     * :show\r\n\r\nThe only thing that is missing that I can think of is returning the error for functions which have an `arity` higher than 3.\r\n\r\nFor example:\r\n\r\nuser_channel_post_path(conn, :show, user, channel, post, foo: \"bar\")\r\n\r\n**TODO**\r\n\r\n * [x] Add a catch all function for each helper\r\n * [x] Sort the valid actions alphabetically.\r\n * [x] Handle an arity > 3\r\n * [x] Show a different error for a valid action with an invalid arity"},"comment":{"url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments/168317349","html_url":"https://github.com/phoenixframework/phoenix/pull/1401#issuecomment-168317349","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/1401","id":168317349,"user":{"login":"Gazler","id":477511,"avatar_url":"https://avatars.githubusercontent.com/u/477511?v=3","gravatar_id":"","url":"https://api.github.com/users/Gazler","html_url":"https://github.com/Gazler","followers_url":"https://api.github.com/users/Gazler/followers","following_url":"https://api.github.com/users/Gazler/following{/other_user}","gists_url":"https://api.github.com/users/Gazler/gists{/gist_id}","starred_url":"https://api.github.com/users/Gazler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gazler/subscriptions","organizations_url":"https://api.github.com/users/Gazler/orgs","repos_url":"https://api.github.com/users/Gazler/repos","events_url":"https://api.github.com/users/Gazler/events{/privacy}","received_events_url":"https://api.github.com/users/Gazler/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T17:07:16Z","updated_at":"2016-01-01T17:07:16Z","body":"I've changed to use two spaces for the actions list and removed the module name as @josevalim suggested.\r\n\r\nOnly the correct arities have a catch-all function defined now."}}