| 441 | /// ``` |
| 442 | #[must_use] |
| 443 | pub fn current_context(&self) -> &C |
| 444 | where |
| 445 | C: Send + Sync + 'static, |
| 446 | { |
| 447 | self.downcast_ref().unwrap_or_else(|| { |
| 448 | // Panics if there isn't an attached context which matches `T`. As it's not possible to |
| 449 | // create a `Report` without a valid context and this method can only be called when `T` |
| 450 | // is a valid context, it's guaranteed that the context is available. |
| 451 | unreachable!( |
| 452 | "Report does not contain a context. This should not happen as a Report must \ |
| 453 | always contain at least one frame.\n\n |
| 454 | Please file an issue to https://github.com/hashintel/hash/issues/new?template=bug-report-error-stack.yml\n\n |
| 455 | Report:\n{self:?}", |
| 456 | ) |
| 457 | }) |
| 458 | } |
| 459 | |
| 460 | /// Converts this `Report` to an [`Error`]. |
| 461 | #[must_use] |