#include "compiler.ih"

void Compiler::errorMessage(CompileFork const &compileFork)
{
    g_tempStream.seekg(0);                  // prepare the error message
    
    if (compileFork.size() <= MAX_ERROR_LINES)
        copy(g_tempStream, compileFork);
    else
    {
        g_tempStream << "Got more than " << MAX_ERROR_LINES <<
                        " lines of error messages.\n"
                        "The error messages are kept for one week at\n" <<
                        g_options.errorURL() << d_pid << endl;
        ofstream out{ g_options.errorDir() + d_pid };
    
        copy(out, compileFork);
    }
}
    
