Create rule S2486: Exceptions should not be ignored (#1667)

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2023-03-21 15:08:24 +01:00 committed by GitHub
parent 71af260baf
commit f70e19219b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
=== Message
Handle this exception or don't catch it at all.

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,43 @@
include::../description.adoc[]
== Noncompliant Code Example
[source,javascript]
----
function f() {
try {
doSomething();
} catch (err) {
}
}
----
== Compliant Solution
[source,javascript]
----
function f() {
try {
doSomething();
} catch (err) {
console.log(`Exception while doing something: ${err}`);
}
}
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]