Our website uses cookies to enhance your browsing experience.
Accept
to the top

Webinar: Let's make a programming language. Lexer - 29.04

>
>
>
V7006. An exception is created but...
menu mobile close menu
Additional information
toggle menu Contents

V7006. An exception is created but never used. The 'throw' keyword may be missing.

Apr 03 2026

The analyzer has detected that an error object (Error) is created but not used.

The example:

function checkIndex(index) {
  if (index < 0)
    new Error("Index out of bounds");
  return index;
}

In this case, the error object is created without interrupting the execution flow because the throw keyword is missing.

The fixed code:

function checkIndex(index) {
  if (index < 0)
    throw new Error("Index out of bounds");
  return index;
}