Modify Rule S1679: fix Dart example, add implementation details
This commit is contained in:
parent
b2a890068d
commit
d836e73941
@ -7,8 +7,8 @@ In such case it's recommended to use `rethrow` instead of just `throw`, to prese
|
|||||||
----
|
----
|
||||||
try {
|
try {
|
||||||
...
|
...
|
||||||
} catch (ex, stacktrace) {
|
} catch (ex) {
|
||||||
rethrow ex; // preserves the original exception with its stacktrace
|
rethrow; // preserves the original exception with its stacktrace
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
@ -41,11 +41,30 @@ void foo() {
|
|||||||
methodThrowsException();
|
methodThrowsException();
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// ...
|
// ...
|
||||||
rethrow ex;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
== Resources
|
== Resources
|
||||||
|
|
||||||
* https://dart.dev/tools/linter-rules/use_rethrow_when_possible[Dart Lint rule]
|
* Dart Docs - https://dart.dev/tools/linter-rules/use_rethrow_when_possible[Dart Linter rule - use_rethrow_when_possible]
|
||||||
|
|
||||||
|
ifdef::env-github,rspecator-view[]
|
||||||
|
|
||||||
|
'''
|
||||||
|
== Implementation Specification
|
||||||
|
(visible only on this page)
|
||||||
|
|
||||||
|
=== Message
|
||||||
|
|
||||||
|
* Use 'rethrow' to rethrow a caught exception.
|
||||||
|
|
||||||
|
=== Highlighting
|
||||||
|
|
||||||
|
The `throw` statement with the argument.
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
endif::env-github,rspecator-view[]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user