Skip to content

Commit 7e3c293

Browse files
committed
Update javascript-interface-library.ts
1 parent 2f3ecc3 commit 7e3c293

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/javascript-interface-library.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,25 @@
102102
return TargetObject
103103
}
104104

105-
/**** throwError - simplifies construction of named errors ****/
105+
/**** throwableError - simplifies construction of named errors ****/
106106

107-
export function throwError (Message:string):never {
107+
export function throwableError (Message:string):Error {
108108
let Match = /^([$a-zA-Z][$a-zA-Z0-9]*):\s*(\S.+)\s*$/.exec(Message)
109109
if (Match == null) {
110-
throw new Error(Message)
110+
return new Error(Message)
111111
} else {
112112
let namedError = new Error(Match[2])
113113
namedError.name = Match[1]
114-
throw namedError
114+
return namedError
115115
}
116116
}
117117

118+
/**** throwError - throws a named error ****/
119+
120+
export function throwError (Message:string):never {
121+
throw throwableError(Message)
122+
}
123+
118124
//------------------------------------------------------------------------------
119125
//-- Value Classification Functions --
120126
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)