mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
05ffe0c441
changed mrb_open() and mrb_open_core() to return mrb_state with mrb->exc set (instead of NULL) when initialization fails. this allows callers to programmatically inspect error details, which is essential for embedded systems without stderr. return NULL only for true allocation failure. added MRB_OPEN_SUCCESS(mrb) macro to check initialization success, since mrb != NULL no longer guarantees success. updated all binary tools (mruby, mirb, mrdb, mrbtest) to use new pattern: check MRB_OPEN_SUCCESS, print exception details via mrb_print_error if available, then mrb_close. mrb_core_init_protect now preserves exception in mrb->exc instead of printing and clearing it, giving caller control over error handling. breaking change: callers must use MRB_OPEN_SUCCESS(mrb) or check both mrb != NULL && mrb->exc == NULL. old NULL-only checks will miss initialization failures. Co-authored-by: Claude <noreply@anthropic.com>