Skip to content

Commit eaa3e11

Browse files
authored
Merge pull request #16 from rowsncolumns/fix/error_codes
Use appropriate error codes
2 parents 0bc6ccf + b1bd354 commit eaa3e11

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

formulas/error.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ FormulaError.VALUE = new FormulaError("#VALUE!");
109109
/**
110110
* NOT_IMPLEMENTED error
111111
* @param {string} functionName - the name of the not implemented function
112-
* @returns {Error}
112+
* @returns {FormulaError}
113113
* @constructor
114114
*/
115115
FormulaError.NOT_IMPLEMENTED = (functionName) => {
116-
return new Error(`Function ${functionName} is not implemented.`)
116+
return new FormulaError("#NAME?", `Function ${functionName} is not implemented.`)
117117
};
118118

119119
/**
@@ -123,17 +123,17 @@ FormulaError.NOT_IMPLEMENTED = (functionName) => {
123123
* @constructor
124124
*/
125125
FormulaError.TOO_MANY_ARGS = (functionName) => {
126-
return new Error(`Function ${functionName} has too many arguments.`)
126+
return new FormulaError("#N/A", `Function ${functionName} has too many arguments.`)
127127
};
128128

129129
/**
130130
* ARG_MISSING error
131131
* @param args - the name of the errored function
132-
* @returns {Error}
132+
* @returns {FormulaError}
133133
* @constructor
134134
*/
135135
FormulaError.ARG_MISSING = (args) => {
136-
return new Error(`Argument type ${args.join(', ')} is missing.`)
136+
return new FormulaError("#N/A", `Argument type ${args.join(', ')} is missing.`)
137137
};
138138

139139
module.exports = FormulaError;

0 commit comments

Comments
 (0)