2 * @fileoverview Rule to restrict what can be thrown as an exception.
3 * @author Dieter Oberkofler
4 * @copyright 2015 Dieter Oberkofler. All rights reserved.
9 //------------------------------------------------------------------------------
11 //------------------------------------------------------------------------------
13 module.exports = function(context) {
17 "ThrowStatement": function(node) {
19 if (node.argument.type === "Literal") {
20 context.report(node, "Do not throw a literal.");
21 } else if (node.argument.type === "Identifier") {
22 if (node.argument.name === "undefined") {
23 context.report(node, "Do not throw undefined.");