rspec/rules/S2737/plsql/rule.adoc
Fred Tingaud ad4a486e52
Modify Rule S2737: LaYC catch rethrow
Co-authored-by: Amélie Renard <44666826+amelie-renard-sonarsource@users.noreply.github.com>
Co-authored-by: Dorian Burihabwa <75226315+dorian-burihabwa-sonarsource@users.noreply.github.com>
2023-06-22 14:04:34 +02:00

48 lines
898 B
Plaintext

== Why is this an issue?
An ``++EXCEPTION WHEN ... THEN++`` clause that only rethrows the caught exception has the same effect as omitting the ``++EXCEPTION++`` clause altogether and letting it bubble up automatically.
[source,sql]
----
BEGIN
SELECT 1/0;
EXCEPTION
WHEN ZERO_DIVIDE THEN
RAISE; -- Noncompliant
WHEN OTHERS THEN
RAISE; -- Noncompliant
END;
----
Such clauses should either be removed or populated with the appropriate logic.
[source,sql]
----
BEGIN
SELECT 1/0;
EXCEPTION
WHEN ZERO_DIVIDE THEN
-- do something to manage the division by zero
COMMIT;
WHEN OTHERS THEN
ROLLBACK;
END;
----
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[]