The return value of 0 means success for Import() call, others (non-zero) mean failure. Error 4 means NO FILE - i.e. there is NO FILE AT ALL in the path that you specified. Error 2/3 are “Bad data” errors. You can’t really “handle” errors because they need to be fixed usually at the source (data being imported) or you need to fix format definition… For best information see import.log file that contains exact reason.