File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ rewritten to comply with these rules.
7979 return value for functions that perform some operation that may
8080 succeed or fail.
8181
82+ 1 . When throwing a ` ValueError ` or emitting a warning, use consistent
83+ phrasing for error messages. Common patterns are:
84+
85+ * Type errors: ` must be of type int ` (use the type name, not e.g. ` must be an integer ` )
86+ * Range/boundary: ` must be between X and Y ` / ` must be greater than [or equal to] X ` / ` must be less than X ` / ` must be finite `
87+ * String constraints: ` must not contain any null bytes ` / ` must not be empty ` / ` must be a single character `
88+ * Valid value: ` must be a valid X ` (e.g. ` must be a valid encoding ` , ` must be a valid calendar ID ` )
89+ * Enum-like: ` must be one of X, Y, or Z `
90+ * Structural: ` must have X ` / ` must have key X ` / ` must have N elements `
91+
8292## User functions/methods naming conventions
8393
84941 . Function names for user-level functions should be enclosed with in the
You can’t perform that action at this time.
0 commit comments