File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
modules/contributor/pages Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -293,6 +293,43 @@ fn config_file(user: User) -> Result<(), Error> {
293
293
294
294
====
295
295
296
+ === Error variant names
297
+
298
+ All error variants must not include any unnesecarry prefixes or suffixes.
299
+ Examples of such prefixes include (but are not limited to) `FailedTo` and `UnableTo`.
300
+ Furthermore, examples for suffixes are `Error` or `Snafu`
301
+ Error variant names must however include verbs or identifiers as a prefix.
302
+
303
+ [WARNING.code-rule,caption=Examples of incorrect code for this rule]
304
+ ====
305
+
306
+ [source,rust]
307
+ ----
308
+ #[derive(Snafu)]
309
+ enum Error {
310
+ FailedToParseConfig,
311
+ HttpRequestError,
312
+ ConfigRead,
313
+ }
314
+ ----
315
+
316
+ ====
317
+
318
+ [TIP.code-rule,caption=Examples of correct code for this rule]
319
+ ====
320
+
321
+ [source,rust]
322
+ ----
323
+ #[derive(Snafu)]
324
+ enum Error {
325
+ ParseConfig,
326
+ HttpRequest,
327
+ ReadConfig,
328
+ }
329
+ ----
330
+
331
+ ====
332
+
296
333
=== Error messages
297
334
298
335
All our error messages must start with a lowercase letter and must not end with a dot.
You can’t perform that action at this time.
0 commit comments