Hi Sean
I got this response from Bill, one of the MapInfo Pro developers back in December but never got to posting it here. Sorry about that.
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.
Include "MapBasic.def"
declare sub main
declare function generalize() as logical
sub main
onerror goto Errortrap
Open table ApplicationDirectory$() & "AnnArbor.tab"
Map from AnnArbor
Select * from AnnArbor
if generalize() = TRUE then
note "Thinned"
else
note "Failed"
end if
exit sub
Errortrap:
note "Main: " & Err() & ": " & Error$()
resume next
end sub
function generalize() as logical
dim rc as logical
onerror goto recover
rc = false
'call debug("smoothing")
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
exit function
recover:
note "generalize: " & Err() & ": " & Error$()
resume next
end function
Let us know if this helps you out
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------