
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>
50 lines
788 B
Plaintext
50 lines
788 B
Plaintext
== Why is this an issue?
|
|
|
|
A `CATCH` clause that only rethrows the caught exception has the same effect as omitting the `CATCH` altogether and letting it bubble up automatically.
|
|
|
|
[source,sql]
|
|
----
|
|
BEGIN TRY
|
|
SELECT 1/0;
|
|
END TRY
|
|
BEGIN CATCH -- Noncompliant
|
|
THROW;
|
|
END CATCH;
|
|
----
|
|
|
|
Such clauses should either be removed or populated with the appropriate logic.
|
|
|
|
[source,sql]
|
|
----
|
|
SELECT 1/0;
|
|
----
|
|
|
|
or
|
|
|
|
[source,sql]
|
|
----
|
|
BEGIN TRY
|
|
SELECT 1/0;
|
|
END TRY
|
|
BEGIN CATCH
|
|
EXECUTE usp_GetErrorInfo;
|
|
THROW;
|
|
END CATCH;
|
|
----
|
|
|
|
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[]
|