diff --git a/lib/server.js b/lib/server.js index 380edda..1ed91c0 100755 --- a/lib/server.js +++ b/lib/server.js @@ -103,7 +103,11 @@ function Server(opts, callback) { if (validationResult.errors.length > 0) { var errMessage = validationResult.errors[0].message; - callback(new Error(errMessage)); + if (callback) { + callback(new Error(errMessage)); + } else { + throw new Error(errMessage); + } } modernOpts = options.populate(modernOpts);