---
source: crates/ruff/src/rules/flake8_errmsg/mod.rs
---
EM.py:5:24: EM101 Exception must not use a string literal, assign to variable first
  |
5 | def f_a():
6 |     raise RuntimeError("This is an example exception")
  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EM101
  |

EM.py:9:24: EM101 Exception must not use a string literal, assign to variable first
   |
 9 | def f_a_short():
10 |     raise RuntimeError("Error")
   |                        ^^^^^^^ EM101
   |

EM.py:14:24: EM102 Exception must not use an f-string literal, assign to variable first
   |
14 | def f_b():
15 |     example = "example"
16 |     raise RuntimeError(f"This is an {example} exception")
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EM102
   |

EM.py:18:24: EM103 Exception must not use a `.format()` string directly, assign to variable first
   |
18 | def f_c():
19 |     raise RuntimeError("This is an {example} exception".format(example="example"))
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ EM103
   |


