It is a bad practice to ``++throw++`` something that's not derived at some level from ``++Error++``. If you can't find an existing ``++Error++`` type that suitably conveys what you need to convey, then you should extend ``++Error++`` to create one. Specifically, part of the point of throwing ``++Error++``s is to communicate about the conditions of the error, but literals have far less ability to communicate meaningfully than ``++Error++``s because they don't include stacktraces. == Noncompliant Code Example [source,javascript] ---- throw 404; // Noncompliant throw "Invalid negative index."; // Noncompliant ---- == Compliant Solution [source,javascript] ---- throw new Error("Status: " + 404); throw new Error("Invalid negative index.");{code} ---- ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) include::../message.adoc[] include::../highlighting.adoc[] ''' == Comments And Links (visible only on this page) include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]