vb6-error-handlinglisted
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