Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 04f687d

Browse files
committed
command and task: throw error if validation schema is missing
1 parent 559c5fa commit 04f687d

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

lib/command.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Command.prototype._initialize = function(connection) {
4545

4646
if (this.argumentsSchema) {
4747
var validation = tv4.validateResult(args, this.argumentsSchema);
48+
49+
if (validation.missing.length > 0) {
50+
throw new Error('Validation schema "' + validation.missing[0] + '" missing!');
51+
}
4852

4953
if (!validation.valid) {
5054
if (validation.error.subErrors && validation.error.subErrors.length > 0) {

lib/task.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Task.prototype._initialize = function(connection) {
3535
if (this.argumentsSchema) {
3636
var validation = tv4.validateResult(args, this.argumentsSchema);
3737

38+
if (validation.missing.length > 0) {
39+
throw new Error('Validation schema "' + validation.missing[0] + '" missing!');
40+
}
41+
3842
if (!validation.valid) {
3943
if (validation.error.subErrors && validation.error.subErrors.length > 0) {
4044
validation.error.subErrors = _.sortBy(validation.error.subErrors, function(s) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "devicestack",
3-
"version": "1.10.3",
3+
"version": "1.10.4",
44
"description": "This module helps you to represent a device and its protocol.",
55
"private": false,
66
"main": "index.js",

releasenotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.10.4
2+
- command and task: throw error if validation schema is missing
3+
14
## v1.10.3
25
- DeviceGuider: introduce DeviceNotFound error
36
- SerialDevice: introduce PortNotFound and PortAccessDenied error

0 commit comments

Comments
 (0)