error-handling
Skill2 starsChanged 6 months agoMITView on GitHub
Reference skill for pydita's error recording and reporting model. Use this skill when you need to understand how errors are accumulated in the shared errors dict, work with ErrorRecord and SEVERITY, filter errors by severity level, or produce a formatted error report using reportErrors(). Covers DitaContext.recordError() and Logger/ConsoleLogger helpers.
80 other projects use a version of this.
Adopted by
Most recently taken up by
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- ahmadvahidi/skill-atlastheir own version, first seen Nov 8, 2026
- nisarth/claude-skills-storetheir own version, first seen Nov 8, 2026
- AndersonAndrad/skillstheir own version, first seen Nov 8, 2026
- AnyOrgName/php-skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use convention-learner, caching and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
codewithmukeshSkillconvention-learner
Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".
Also in 3 projects that use this
wpankSkillcaching
Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.
Also in 6 projects that use this
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 12 projects that use this
codewithmukeshSkillopentelemetry
OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".
Also in 3 projects that use this
MovGP0Skillmodern-csharp
Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.
Also in 3 projects that use this
MicrosoftSkillresilience
Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.
Also in 4 projects that use this
Other versions80 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 80
- microsoft/data-formulator★ 17ksame name
- epicenter-md/epicenter★ 4.8ksame name
- EpicenterHQ/epicenter★ 4.8ksame name
- software-mansion/react-native-executorch★ 1.8ksame name
- CloudAI-X/claude-workflow★ 1.4ksame name
- CloudAI-X/claude-workflow-v2★ 1.4ksame name
- codewithmukesh/dotnet-claude-kit★ 808same name
- alchemyplatform/aa-sdk★ 321same name
- Resgrid/Core★ 238same name
- DevelopersGlobal/ai-agent-skills★ 216same name
70 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- context-setupSkill
- dita-best-practicesSkill
- ditaval-helperSkill
- generate-bookmapSkill
- generate-ditamapSkill
- generate-dita-topicSkill
- generate-keyrefsSkill
- keyspace-debugSkill
- map-resolveSkill
- pdf-to-ditaSkill
- refactor-dita-contentSkill
- review-dita-guideSkill
- validate-bookmapSkill
- validate-ditamapSkill
- validate-dita-topicSkill
- visitor-extendSkill
- xslt-dita-helperSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 64 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
All error utilities live in pydita.loggingutils.
“Common” is measured: kept by at least 6 in 10 of the 64 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
pydita uses a shared mutable dict as its error accumulator, passed by reference through every API call. Errors are never raised and swallowed silently — they are recorded as ErrorRecord objects keyed by a string identifier (usually an absolute file path or a key name).
All error utilities live in pydita.loggingutils.
Core types
SEVERITY enum
Ordered severity levels (ascending):
from pydita.loggingutils import SEVERITY
SEVERITY.OTHER # 0 — unclassified
SEVERITY.DEBUG # 1 — debug trace
SEVERITY.INFO # 2 — informational
SEVERITY.ERROR # 3 — recoverable error
SEVERITY.WARN # 4 — warning (higher than ERROR in pydita's ordering)
SEVERITY.FATAL # 5 — unrecoverableNote: In pydita's
OrderedEnum,WARN(4) is higher thanERROR(3). This is intentional — WARNings are considered more severe than recoverable ERRORs.
ErrorRecord
from pydita.loggingutils import ErrorRecord, SEVERITY
rec = ErrorRecord(
err=exception, # Exception — required
operation="myFunc()", # str — which function caught it
severity=SEVERITY.ERROR,
key="file://abs/path", # str — the dict key this belongs to
traceBack="...", # str — traceback.format_exc() output
)
str(rec) # '[ERROR] "file://path" myFunc(): <exception message>'Recording errors
Direct function call
from pydita import loggingutils
import traceback
errors = {}
try:
do_something()
except Exception as e:
loggingutils.recordError(
errors,
key="my-operation",
err=e,
operation="do_something()",
severity=loggingutils.SEVERITY.ERROR,
traceBack=traceback.format_exc(),
)Via DitaContext
ctx.recordError(
key="some-key",
error=exception,
operation="myProcessor()",
severity=SEVERITY.WARN,
)
# Delegates to loggingutils.recordError(ctx.getErrors(), ...)Errors dict structure
errors = {
"/abs/path/to/file.ditamap": [ErrorRecord, ErrorRecord, ...],
"key-name": [ErrorRecord],
}- One key can have multiple
ErrorRecordobjects (e.g., multiple parse errors in the same file). - The key is any string — typically a file URI, file path, or DITA key name.
Reporting errors
Full report string
from pydita import loggingutils
report = loggingutils.reportErrors(errors, showTraceBack=False)
print(report)
# Have 3 total errors:
# [ERROR] "path/to/sub.ditamap" resolveSubmap(): ...
# [WARN] "key-name" constructKeySpace(): ...Filter by severity
from pydita.loggingutils import SEVERITY
fatal_errors = {
k: [r for r in recs if r.getSeverity() >= SEVERITY.FATAL]
for k, recs in errors.items()
if any(r.getSeverity() >= SEVERITY.FATAL for r in recs)
}Check for any errors above a threshold
def has_errors(errors: dict, min_severity=SEVERITY.ERROR) -> bool:
return any(
r.getSeverity() >= min_severity
for recs in errors.values()
for r in recs
)Logging helpers
pydita provides Logger (abstract) and ConsoleLogger (concrete) for structured log output:
from pydita.loggingutils import ConsoleLogger, SEVERITY
log = ConsoleLogger(logging_level=SEVERITY.WARN)
log.debug("ignored — below WARN threshold")
log.warn("printed: [WARN] printed: ...")
log.error("printed: [ERROR] ...")
log.fatal("printed: [FATAL] ...")
# Print raw message without severity prefix
log.print("Raw message output")Implement a custom logger by subclassing Logger and overriding _log_message():
from pydita.loggingutils import Logger, SEVERITY
class FileLogger(Logger):
def __init__(self, path: str):
super().__init__(logging_level=SEVERITY.INFO)
self._file = open(path, "w")
def _log_message(self, message, severity: SEVERITY):
if severity >= self.get_logging_level():
self._file.write(f"[{severity.name}] {message}\n")Best practices
| Rule | Rationale |
Create one errors = {} per pipeline run | Prevents cross-contamination between independent runs |
Pass errors to every pydita function | Missing it silently discards errors |
Check errors after resolveMap() and after KeyspaceManager() | Both can fail silently |
Use traceBack=traceback.format_exc() in except blocks | Makes root-cause analysis much easier |
Filter by SEVERITY.ERROR or higher for pass/fail decisions | DEBUG and INFO records should not count as failures |
See also
context-setup— howerrorsis shared across the full pipelinemap-resolve— error patterns during map resolution
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

