Strict Mode and Error Behavior - danielep71/VBA-Performance_Manager GitHub Wiki

Strict Mode and Error Behavior

This page explains how StrictMode affects validation and how the class responds to invalid timing usage.

cPerformanceManager is intentionally session-bound. That means the class does not merely read clocks. It also validates whether the caller is using the timing session coherently.

StrictMode

StrictMode is a public Boolean property.

Default:

True

In strict mode

The class raises errors for misuse such as:

  • invalid method IDs passed to StartTimer
  • requesting QPC when unavailable
  • calling ElapsedSeconds before StartTimer
  • passing an explicit elapsed method that does not match the active session

In non-strict mode

The class attempts documented fallback/coercion behavior where supported.

Checkpoint/reporting contract errors

Checkpoint/reporting validation is separate from StrictMode, but it is part of the class’s broader error behavior.

The class raises when:

  • Checkpoint is called before StartTimer
  • SetRunLabel is called after checkpoint capture has already begun in the current timing session

Recommendation

For benchmarking and regression work, strict mode is usually the safer choice because it exposes mistakes early.

For detailed examples, see Error Handling and Strict Mode.