rspec/rules/S3984/vbnet/rule.adoc
2022-02-04 16:28:24 +00:00

37 lines
659 B
Plaintext

Creating a new ``++Exception++`` without actually throwing it is useless and is probably due to a mistake.
== Noncompliant Code Example
[source,vbnet]
----
If x < 0 Then
Dim ex = New ArgumentException("x must be nonnegative")
End If
----
== Compliant Solution
[source,vbnet]
----
If x < 0 Then
Throw New ArgumentException("x must be nonnegative")
End If
----
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[]