← ClaudeAtlas

vb6-error-handlinglisted

Applies the CSEH (Code Style for Error Handler) pattern when adding or editing error handling in Visual Basic 6 procedures. Covers the structured On Error GoTo template with EhHeader/EhFooter regions, two CSEH styles (ErrRaise for utility functions that propagate to callers, and MsgBox for top-level UI procedures), line numbering (starting at 100, increments of 5) to enable Erl in error handlers, structured re-raise via Err.Raise with vbObjectError offset and qualified source string in App.Module.Procedure format, error message format including Err.Number, Err.Description and Erl, cleanup-before-raise discipline, and the legitimate use of On Error Resume Next strictly limited to cleanup and dispose routines. Activates whenever modifying VB6 procedures that have or need On Error handlers, the CSEH marker comment, numbered code lines, Err.Raise calls, or any discussion of error propagation, error logging, or fault tolerance in VB6.
alexcassol/claude-vb6-skills · ★ 0 · API & Backend · score 70
Install: claude install-skill alexcassol/claude-vb6-skills
# VB6 Error Handling — CSEH Pattern VB6 has no `try`/`catch`. The model is `On Error GoTo <label>` with structured cleanup. The **CSEH** (Code Style for Error Handler) convention standardizes this pattern across the codebase so error paths are predictable, log output is consistent, and `Erl` (error line) is meaningful in production logs. CSEH style is declared by a marker comment above the procedure signature: ```vb 'CSEH: ErrRaise Public Function GetActiveCustomer(...) As Object ``` The `<EhHeader>` and `<EhFooter>` tags delimit regions that may be regenerated by external tooling (MZ-Tools or similar). **Never alter the delimiter format or remove the tags** — automation depends on them. ## 1. Two CSEH styles | Style | Marker | Handler behavior | Use for | | ----------- | ------------------ | ----------------------------------------------------------------- | ---------------------------------------- | | `ErrRaise` | `'CSEH: ErrRaise` | Re-raises with `Err.Raise vbObjectError + <offset>, ..., msg` | Utility functions, library routines, any procedure called by other code | | `MsgBox` | `'CSEH: MsgBox` | Displays critical dialog and returns to caller without re-raising | Top-level UI event handlers, command buttons, menu items | **Default for new code: `ErrRaise`**. The `MsgBox` style is reserved for the outermost layer (event handlers) where errors must be surf