---
source: crates/ruff_linter/src/rules/tryceratops/mod.rs
---
TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:13:9
   |
11 |         a = 1
12 |     except Exception:
13 |         logging.error("Context message here")
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |
15 |         if True:
   |
help: Replace with `exception`
   |
12 |     except Exception:
   -         logging.error("Context message here")
13 +         logging.exception("Context message here")
14 |
   |

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:16:13
   |
15 |         if True:
16 |             logging.error("Context message here")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `exception`
   |
15 |         if True:
   -             logging.error("Context message here")
16 +             logging.exception("Context message here")
17 |
   |

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:27:9
   |
25 |         a = 1
26 |     except Exception:
27 |         logger.error("Context message here")
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 |
29 |         if True:
   |
help: Replace with `exception`
   |
26 |     except Exception:
   -         logger.error("Context message here")
27 +         logger.exception("Context message here")
28 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:30:13
   |
29 |         if True:
30 |             logger.error("Context message here")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `exception`
   |
29 |         if True:
   -             logger.error("Context message here")
30 +             logger.exception("Context message here")
31 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:37:9
   |
35 |         a = 1
36 |     except Exception:
37 |         log.error("Context message here")
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38 |
39 |         if True:
   |
help: Replace with `exception`
   |
36 |     except Exception:
   -         log.error("Context message here")
37 +         log.exception("Context message here")
38 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:40:13
   |
39 |         if True:
40 |             log.error("Context message here")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `exception`
   |
39 |         if True:
   -             log.error("Context message here")
40 +             log.exception("Context message here")
41 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:47:9
   |
45 |         a = 1
46 |     except Exception:
47 |         self.logger.error("Context message here")
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 |
49 |         if True:
   |
help: Replace with `exception`
   |
46 |     except Exception:
   -         self.logger.error("Context message here")
47 +         self.logger.exception("Context message here")
48 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
  --> TRY400.py:50:13
   |
49 |         if True:
50 |             self.logger.error("Context message here")
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `exception`
   |
49 |         if True:
   -             self.logger.error("Context message here")
50 +             self.logger.exception("Context message here")
51 |
   |
note: This is an unsafe fix and may change runtime behavior

TRY400 [*] Use `logging.exception` instead of `logging.error`
   --> TRY400.py:100:9
    |
 98 |         a = 1
 99 |     except Exception:
100 |         error("Context message here")
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101 |
102 |         if True:
    |
help: Replace with `exception`
    |
99  |     except Exception:
    -         error("Context message here")
100 +         exception("Context message here")
101 |
    |

TRY400 [*] Use `logging.exception` instead of `logging.error`
   --> TRY400.py:103:13
    |
102 |         if True:
103 |             error("Context message here")
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace with `exception`
    |
102 |         if True:
    -             error("Context message here")
103 +             exception("Context message here")
104 |
    |

TRY400 [*] Use `logging.exception` instead of `logging.error`
   --> TRY400.py:143:13
    |
141 |             b = 2
142 |         except Exception:
143 |             error("Context message here")
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Replace with `exception`
    |
142 |         except Exception:
    -             error("Context message here")
143 +             exception("Context message here")
    |
