Leo_Verto

LeoError 1.0

Mar 7th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Error function
  2. function leoError(errorWhen,errorInfo)
  3.     resetScreen()
  4.     print("A fatal error occured when "..errorWhen)
  5.     if errorInfo ~= "" then
  6.         print (errorInfo)
  7.     end
  8. end
  9.  
  10. --Sample use
  11. if fs.exists(sFile) then
  12.         local hRead = assert(fs.open(sFile, "r"))
  13.         sTime = hRead.readLine()
  14.         hRead.close()
  15.     else
  16.         leoError("trying to open alarmtime.txt","Please check if 'alarmtime.txt' in the folder of the file 'alarm' exists.")
  17.     end
  18.  
  19. --Output for user
  20. A fatal error occured when trying to open alarmtime.txt
  21. Please check if 'alarmime.txt' in the folde rof the file 'alarm' exists.
Advertisement
Add Comment
Please, Sign In to add comment