Checking for error code before parsing