For these kind of things I would always use ERR:
Code: (Select All)
FAULT:
'https://qb64phoenix.com/qb64wiki/index.php/ERROR_Codes
Select Case Err
Case 52 'Bad file name or number
Print "Could not access serial"
Case 68 'Device unavailable
Print "Could not open serial"
Case Else
Print "Unknown error"; Err; " on line"; _ErrorLine
End Select
Resume Next
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience