Skip to content

Commit

Permalink
Add an error constructor and git repo url
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Feb 19, 2013
1 parent 47a479e commit b177a9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"api",
"descriptor"
],
"repository": {
"type": "git",
"url": "https://github.com/feugy/swagger-jack"
},
"license": "MIT",
"version": "1.1.0",
"main": "lib/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/validator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ validate = (req, path, specs, next) ->
if type is 'file'
value = req.files?[spec.name]
# specific case of files: do not validate with json-gate
return done if !(value?) then "#{errPrefix} is required"
return done if !(value?) then new Error "#{errPrefix} is required"
else
value = req.body[spec.name]
else
errPrefix = 'body'
# unamed parameter: take all body
value = req.body
else
throw new Error("unsupported parameter type #{spec.kind}")
throw new Error "unsupported parameter type #{spec.kind}"

if type is 'array'
# multiple values awaited
Expand Down

0 comments on commit b177a9c

Please sign in to comment.