Advertisement
Marlingaming

Aperture Science OS System - Error Handler

Sep 24th, 2021 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. --this program searchs for errors, checks what Program sent the Error, and displays what Actions the User can take to fix the Error, or bypass it
  2. local w, h = term.getSize()
  3.  
  4. function Search()
  5. local event, id, success, reason = os.pullEvent("task_complete")
  6. if success == true then
  7. Search()
  8. else
  9. ErrorDetected(id, reason)
  10. end
  11. end
  12.  
  13. function ErrorDetected(id, reason)
  14. term.clear()
  15. print("error has occured in "..id)
  16. print(id.."-"..reason)
  17. print("please choose which action to commence")
  18. print("1 - Shutdown")
  19. print("2 - return to menu")
  20. print("3 - start Scan")
  21.  
  22. while true do
  23. local event, key = os.pullEvent("key")
  24. if key == keys.one then
  25. shell.switchTab(1,shell.run("ShutdownPrompt"))
  26. break
  27. elseif key == keys.two then
  28. shell.switchTab(1,shell.run("ApertureOS_Base"))
  29. break
  30. elseif key == keys.three then
  31. shell.switchTab(1,shell.run("ShutdownPrompt"))
  32. break
  33. end
  34. end
  35. end
  36.  
  37. Search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement