Skip to content

fix: add context to error messages for better debugging#126

Merged
jgowdy-godaddy merged 1 commit intomainfrom
improve-error-context
Mar 4, 2026
Merged

fix: add context to error messages for better debugging#126
jgowdy-godaddy merged 1 commit intomainfrom
improve-error-context

Conversation

@jgowdy-godaddy
Copy link
Collaborator

Summary

  • Adds function names and context to all error messages
  • Uses consistent error handling pattern
  • Makes debugging easier

Changes

  1. Add function names to all CobhanBuffer error messages
  2. Include operation context (e.g., 'CobhanBuffer::set_data_len_bytes')
  3. Add clarification about limits (e.g., '2GB limit')
  4. Fix inconsistent error handling - replaced direct napi_throw_error with NapiUtils::ThrowException

Examples

Before:

"Requested data length exceeds maximum allowable size"

After:

"CobhanBuffer::set_data_len_bytes: Requested data length exceeds maximum allowable size (2GB limit)"

Benefits

  • Easier debugging - immediately see which function threw the error
  • Clear understanding of constraints and limits
  • Consistent error handling throughout the codebase

Test plan

  • All tests pass
  • Error messages are more descriptive
  • No breaking changes

🤖 Generated with Claude Code

@jgowdy-godaddy jgowdy-godaddy force-pushed the improve-error-context branch 2 times, most recently from c517e9f to cfbb8a1 Compare August 3, 2025 19:56
@jgowdy-godaddy jgowdy-godaddy force-pushed the improve-error-context branch from edc31e3 to 4b169f3 Compare March 4, 2026 20:23
- Add function name prefixes to all CobhanBuffer error messages
- Add 2GB limit clarification to size-related error messages
- Fix set_data_len_bytes message to accurately say "maximum data size"
- Replace napi_throw_error with NapiUtils::ThrowException in ToString() for
  consistent error handling via C++ exceptions
@jgowdy-godaddy jgowdy-godaddy force-pushed the improve-error-context branch from 4b169f3 to 68e9a6b Compare March 4, 2026 20:26
@jgowdy-godaddy jgowdy-godaddy merged commit f934a17 into main Mar 4, 2026
2 checks passed
@jgowdy-godaddy jgowdy-godaddy deleted the improve-error-context branch March 4, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants