Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GCodeException.cpp « GCodes « src - github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44e74a761307a6afd0fee91b61e4e5b5e1636659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * ParseException.cpp
 *
 *  Created on: 21 Dec 2019
 *      Author: David
 */

#include "GCodeException.h"

#include <General/StringRef.h>
#include <GCodes/GCodeBuffer/GCodeBuffer.h>

// Construct the error message. This will be prefixed with "Error: " when it is returned to the user.
void GCodeException::GetMessage(const StringRef &reply, const GCodeBuffer& gb) const noexcept
{
	reply.copy((gb.IsDoingFileMacro()) ? "in file macro" : (gb.IsDoingFile()) ? "in GCode file" : "while executing command");
	if (line >= 0 && column >= 0 && gb.IsDoingFile())
	{
		reply.catf(", line %d column %d", line, column + 1);
	}
	reply.cat(": ");
	reply.catf(message, param.u);
}

// End