cms-gem-daq-project / ctp7_modules

0 stars 13 forks source link

Feature Request: configureVFAT3sLocal() Prints Line it failed on in error key #140

Closed bdorney closed 4 years ago

bdorney commented 5 years ago

Brief summary of issue

Right now if configureVFAT3sLocal fails to parse a VFAT3 conf file it can be very difficult to understand what the problem is. Requesting a change to legacy branch release/v1.1.X

Types of issue

Expected Behavior

Suggest to change to:

        while (std::getline(infile,line))
        {
            std::string reg_basename = "GEM_AMC.OH.OH" + std::to_string(ohN) + ".GEB.VFAT"+std::to_string(vfatN)+".CFG_";
            std::stringstream iss(line);
            if (!(iss >> dacName >> dacVal)) {
                LOGGER->log_message(LogManager::ERROR, stdsprintf("ERROR READING VFAT3 CONF FILE FOR OH%i VFAT%i LINE: %s", ohN, vfatN, line));
                la->response->set_string("error", stdsprintf("Error Reading VFAT3 Conf File for OH%i VFAT%i line: %s", ohN, vfatN, line));
                break;
            }
            else
            {
                regName = reg_basename + dacName;
                writeReg(la, regName, dacVal);
            }
        }

Current Behavior

Currently if configureVFAT3sLocal fails to parse one or more of the VFAT3 config files on the CTP7 it throws an error but it can be very difficult to determine the line it breaks on:

https://github.com/cms-gem-daq-project/ctp7_modules/blob/92eeadc1993dfd85a19cd0a187f76eefb5029e06/src/vfat3.cpp#L148-L162

Context (for feature requests)

Easier troubleshooting and debugging.

Your Environment

lpetre-ulb commented 4 years ago

Since cmsgemos!11 in the new repository, the file for which the error occurred is reported. A a temporary solution, it was no deemed including the line and line number in the error message itself.