76 lines
1.0 KiB
Plaintext
76 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,dart]
|
|
----
|
|
void save() {
|
|
try {
|
|
saveDocument();
|
|
} catch (exception) {
|
|
}
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,dart]
|
|
----
|
|
void save() {
|
|
try {
|
|
saveDocument();
|
|
} catch (exception) {
|
|
log(exception);
|
|
}
|
|
}
|
|
----
|
|
|
|
[source,dart]
|
|
----
|
|
void save() {
|
|
try {
|
|
saveDocument();
|
|
} catch (_) { // Compliant, ignored intentionally
|
|
}
|
|
}
|
|
----
|
|
|
|
[source,dart]
|
|
----
|
|
void save() {
|
|
try {
|
|
saveDocument();
|
|
} catch (exception) { // Compliant, left a comment
|
|
// ignored intentionally
|
|
}
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
* Dart Docs - https://dart.dev/tools/linter-rules/empty_catches[Dart Linter rule - empty_catches]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Empty catch block.
|
|
|
|
=== Highlighting
|
|
|
|
The empty catch body.
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|