# testsuite_error_include section for BASIC256

# Modification History
# date		programmer	description
# 20140204	j.m.reneau	split from testsuite

# simple errortrap using subroutine and onerror
subroutine errortrap()
   # do nothing but return so I can see error
end subroutine

onerror errortrap
print 8 / 0
call n("trap div zero", lasterror, 50)
throwerror 888
call n("trap throw 888", lasterror, 888)
offerror

# Error Trapping - Try Catch with gosub onerror for error in catch
goto trycatchtestjump

trycatchtest: # error trap for trycatch
a+= 2048
return

trycatchtestjump: ###
onerror trycatchtest
a = 0
try
   a = a + 1
   try
      a = a + 16
      throwerror 9999
      a = a + 32
   catch
      a = a + 64
      #error in catch actually back at previous level
      throwerror 9999
      a = a + 8
   end try
   a = a + 2
catch
   a = a + 4
   try
      a = a + 128
      throwerror 9999
      a = a + 256
   catch
      a = a + 512
      # error in catch/catch back in onerror
      throwerror 9999
      a = a + 1024
   end try
   a = a + 8
end try
offerror
call n("a=3805 try/catch",a,3805)