{"action":"opened","issue":{"url":"https://api.github.com/repos/gaborcsardi/argufy/issues/17","labels_url":"https://api.github.com/repos/gaborcsardi/argufy/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/gaborcsardi/argufy/issues/17/comments","events_url":"https://api.github.com/repos/gaborcsardi/argufy/issues/17/events","html_url":"https://github.com/gaborcsardi/argufy/issues/17","id":101876081,"number":17,"title":"Syntax for specifying a custom error message","user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-19T12:04:41Z","updated_at":"2015-08-19T12:04:41Z","closed_at":null,"body":"I think it would be useful to have an extension of the syntax to allow users to specify a custom error message. i.e.\r\n\r\n```r\r\nfun <- function(x = ? is.numeric : \"X must be a number!\") x\r\n```\r\nUsing `:` makes the syntax like C's ternary if which seems nice.  However I am not sure how challenging parsing the `:` would be (disamgibuating normal uses of `:`).  So if it proves too messy reusing the `?` again would work as well and maybe gives the expressions a nice symmetry, I am fine with either method.\r\n```r\r\nfun <- function(x = ? is.numeric ? \"X must be a number!\") x\r\n```\r\nIn this case I guess the implementation would change from just wrapping the checks in `stopifnot()` to something like\r\n```r\r\nif (!all(checks)) {\r\n  stop(message, call. = FALSE)\r\n}\r\n```"}}