make recording and reporting errors and nonlocal and global directives more robust (closes #25973)
3 files changed