From 4d1e8bb193a7315a8fcfe1e09c33befdee660b7d Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Wed, 18 Jul 2018 15:33:44 +0530 Subject: add throw after message() --- js/Sources/CLKIN_f.js | 1 + js/Sources/CLOCK_f.js | 1 + js/Sources/CONST.js | 2 ++ js/Sources/CONST_f.js | 1 + js/Sources/CURV_f.js | 1 + js/Sources/FROMWS_c.js | 4 ++++ js/Sources/GEN_SQR.js | 1 + js/Sources/IN_f.js | 3 +++ js/Sources/RAND_f.js | 1 + js/Sources/RAND_m.js | 2 ++ js/Sources/SampleCLK.js | 2 ++ 11 files changed, 19 insertions(+) (limited to 'js/Sources') diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index 9705db36..cb550389 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -31,6 +31,7 @@ function CLKIN_f() { } if (this.prt<=0) { message("Port number must be a positive integer"); + throw "user error"; } else { this.model.ipar = new ScilabDouble([this.prt]); this.model.evtout = new ScilabDouble([1]); diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index 3ebc7d0c..df9054ba 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -74,6 +74,7 @@ function CLOCK_f() { } if (this.dt<=0) { message("period must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/CONST.js b/js/Sources/CONST.js index 9676863b..a3a51cb3 100644 --- a/js/Sources/CONST.js +++ b/js/Sources/CONST.js @@ -32,8 +32,10 @@ function CONST() { var nout = size(this.C,"*"); if (nout==0) { message("C must have at least one element"); + throw "user error"; } else if (and(sz>1)) { message("C matrix is not supported, use CONST_m instead"); + throw "user error"; } else { this.model.rpar = new ScilabDouble(this.C.slice()); this.model.out = new ScilabDouble([nout]); diff --git a/js/Sources/CONST_f.js b/js/Sources/CONST_f.js index ece232ed..fcd527ac 100644 --- a/js/Sources/CONST_f.js +++ b/js/Sources/CONST_f.js @@ -31,6 +31,7 @@ function CONST_f() { var nout = size(this.C,"*"); if (nout==0) { message("C must have at least one element"); + throw "user error"; } else { this.model.rpar = new ScilabDouble(this.C.slice()); this.model.out = new ScilabDouble([nout]); diff --git a/js/Sources/CURV_f.js b/js/Sources/CURV_f.js index d8eb53ba..8939719f 100644 --- a/js/Sources/CURV_f.js +++ b/js/Sources/CURV_f.js @@ -49,6 +49,7 @@ function CURV_f() { var n = size(xx,"*"); if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { message("You have not defined a function"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/FROMWS_c.js b/js/Sources/FROMWS_c.js index 1b3b8b09..5e1810ea 100644 --- a/js/Sources/FROMWS_c.js +++ b/js/Sources/FROMWS_c.js @@ -46,20 +46,24 @@ function FROMWS_c() { } if (!(this.Method==0||this.Method==1||this.Method==2||this.Method==3)) { message("Interpolation method should be chosen in [0,1,2,3]"); + throw "user error"; var ok = false; } if (!(this.ZC==0||this.ZC==1)) { message("Zero crossing should be either 0 or 1"); + throw "user error"; var ok = false; } if (!(this.OutEnd==0||this.OutEnd==1||this.OutEnd==2)) { message("Output at end option should be either 0 or 1"); + throw "user error"; var ok = false; } var r = false; var ierr = execstr("r=validvar(varnam)","errcatch"); if (!r) { message([["Invalid variable name."],["Please choose another variable name."]]); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js index 47674794..3b9df67b 100644 --- a/js/Sources/GEN_SQR.js +++ b/js/Sources/GEN_SQR.js @@ -94,6 +94,7 @@ function GEN_SQR() { } } else { message(lasterror()); + throw "user error"; var ok = false; } } diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index 67fa7614..eddd05b6 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -42,10 +42,13 @@ function IN_f() { var prt = int(prt); if (prt<=0) { message("Port number must be a positive integer"); + throw "user error"; } else if (!isequal(size(otsz,"*"),2)) { message("Outport Size must be a 2 elements vector"); + throw "user error"; } else if (((ot<1||ot>9)&&(ot!=-1))) { message("Outport type must be a number between 1 and 9, or -1 for inheritance."); + throw "user error"; } else { if (this.model.ipar!=prt) { var needcompile = 4; diff --git a/js/Sources/RAND_f.js b/js/Sources/RAND_f.js index bdbfd09f..e67bbd98 100644 --- a/js/Sources/RAND_f.js +++ b/js/Sources/RAND_f.js @@ -51,6 +51,7 @@ function RAND_f() { } if (this.flag!=0&&this.flag!=1) { message("flag must be equal to 1 or 0"); + throw "user error"; } else { var nout = size(this.a,"*"); this.graphics.exprs = new ScilabDouble(this.exprs); diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index 50ec146c..0ac19999 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -59,6 +59,7 @@ function RAND_m() { } if (this.flag!=0&&this.flag!=1) { message("flag must be equal to 1 or 0"); + throw "user error"; } else { var out = size(this.a); if (this.typ==1) { @@ -73,6 +74,7 @@ function RAND_m() { this.model.dstate = new ScilabDouble([this.seed_c.slice()],[0*[[real(this.a.slice())],[imag(this.a.slice())]]]); } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/SampleCLK.js b/js/Sources/SampleCLK.js index fe37b67a..b652d744 100644 --- a/js/Sources/SampleCLK.js +++ b/js/Sources/SampleCLK.js @@ -33,10 +33,12 @@ function SampleCLK() { } if (this.frequ<0) { message("Frequency must be a positif number"); + throw "user error"; var ok = false; } if (abs(this.offset)>this.frequ) { message("The |Offset| must be less than the Frequency"); + throw "user error"; var ok = false; } if (ok) { -- cgit