Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Aug 27, 2024
1 parent 0a4c088 commit b082583
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespaces = true

# ----------------------------------------- Project Metadata -------------------------------------
[project]
version = "0.0.0.dev0"
version = "0.0.0.dev1"
name = "ExceptionMan"
dependencies = [
"markitup",
Expand Down
1 change: 1 addition & 0 deletions src/exceptionman/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from exceptionman.reporter_exception import ReporterException
18 changes: 11 additions & 7 deletions src/exceptionman/reporter_exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from typing import Literal as _Literal

from markitup import html as _html, doc as _doc
Expand All @@ -16,12 +18,14 @@ def __init__(
):
message_html = message_html or message
description_html = description_html or description
self.summary = message + (f"\n{description}" if description else "")

super().__init__(message + (f"\n{description}" if description else ""))
super().__init__(self.summary)
self.message = message
self.description = description
self.message_html = message_html
self.description_html = description_html
self.summary_html = self.message_html + (f" {self.description_html}" if self.description_html else "")
self._html_head = _html.elem.head(
[
_html.elem.title(report_heading),
Expand Down Expand Up @@ -53,15 +57,15 @@ def __init__(
def report(self, mode: _Literal["full", "short"] = "full", md: bool = False) -> _doc.Document:
"""Generate a report for the exception."""
detail_section_content = self._report_content(mode, md)
summary = self.message_html + (f" {self.description_html}" if self.description_html else "")
section = _doc.from_contents(
heading="Error Details",
content=detail_section_content,
)
report = _doc.from_contents(
heading=self._report_heading,
content={"summary": _html.elem.p(summary, align="justify")},
content={"summary": _html.elem.p(self.summary_html, align="justify")},
head=self._html_head if not md else None,
section=_doc.from_contents(
heading="Error Details",
content=detail_section_content,
) if detail_section_content else None,
section= {"details": section} if detail_section_content else None,
)
if not md:
report.add_highlight(style="monokai-sublime", languages=["yaml", "json", "toml"])
Expand Down

0 comments on commit b082583

Please sign in to comment.