I tried this out and it does not crash and the error (actually a warning of sorts - even though MIPro does not have warnings) is trapped and resumed.
Code provided below.
Error is likely coming from the call to debug(), which he did not provide, so it's commented out here.
declare sub main
declare function generalize() as logical
onerror goto Errortrap
Open table ApplicationDirectory$() & "AnnArbor.tab"
Map from AnnArbor
Select * from AnnArbor
if generalize() = TRUE then
note "Main: " & Err() & ": " & Error$()
function generalize() as logical
dim rc as logical
onerror goto recover
rc = false
Create Object As Union From Selection Into Table Cosmetic1
Objects Snap From Selection Tolerance Node 50 Vector 50 Units "m" Thin Bend 50 Distance 50 Units "m"
rc = true
generalize = rc
note "generalize: " & Err() & ": " & Error$()