Log just this exception, without full traceback. Generates an error log message just for this exception, not the full traceback, including without any chained exceptions. This should be used in cases where this exception has enough information or when the rest of the traceback does
(
exc: Exception,
msg: str,
*args,
# Extra note to add to the end of the error message when shown on
# the log, but not included in the dagger.Error message.
note: str = "",
)
| 99 | |
| 100 | |
| 101 | def log_exception_only( |
| 102 | exc: Exception, |
| 103 | msg: str, |
| 104 | *args, |
| 105 | # Extra note to add to the end of the error message when shown on |
| 106 | # the log, but not included in the dagger.Error message. |
| 107 | note: str = "", |
| 108 | ): |
| 109 | """Log just this exception, without full traceback. |
| 110 | |
| 111 | Generates an error log message just for this exception, not the full |
| 112 | traceback, including without any chained exceptions. |
| 113 | |
| 114 | This should be used in cases where this exception has enough information |
| 115 | or when the rest of the traceback doesn't add anything particularly useful, |
| 116 | so there's less noise to sort through while debugging. |
| 117 | |
| 118 | The full traceback will still be included in dag.Error() values which |
| 119 | could at some point be optionally shown in the web/cloud UI at some |
| 120 | point, but it's also fully available to LLM in the meantim. |
| 121 | """ |
| 122 | if note and hasattr(exc, "add_note"): |
| 123 | exc.add_note(note) |
| 124 | logger.error(msg, *args, exc_info=(type(exc), exc, None)) |
| 125 | |
| 126 | |
| 127 | async def record_exception(exc: Exception): |
no test coverage detected