The system variable #L_IOStatus stores error information in the bottom 8 bits.
#L_IOStatus
Identify
When the I/O attribute of the specified unit is the same as that of the actually connected unit, but the points differ, "1" is set.
Settings
When the I/O attribute of the specified unit is different from that of the actually connected unit, "1" is set.
Major Fault
"1" is set when it detects a fault that requires stopping the logic.