MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / GetMessage

Method GetMessage

src/GCodes/GCodeException.cpp:57–140  ·  view source on GitHub ↗

Construct the error message. This will be prefixed with "Error: " when it is returned to the user.

Source from the content-addressed store, hash-verified

55
56// Construct the error message. This will be prefixed with "Error: " when it is returned to the user.
57void GCodeException::GetMessage(const StringRef &reply, const GCodeBuffer *null gb) const noexcept
58{
59 // Print the file location, if possible
60 switch(source)
61 {
62 case GCodeExceptionSource::file:
63 reply.copy("in GCode file");
64 break;
65 case GCodeExceptionSource::macro:
66 reply.copy("in file macro");
67 break;
68 case GCodeExceptionSource::other:
69 default:
70 break;
71 }
72
73 if (line >= 0)
74 {
75 reply.catf(" line %d", line);
76 if (column >= 0)
77 {
78 reply.catf(" column %d", column + 1);
79 }
80 reply.cat(": ");
81 }
82 else if (column >= 0)
83 {
84 reply.catf(" at column %d: ", column + 1);
85 }
86 else
87 {
88 reply.Clear();
89 }
90
91 // Print the command letter/number, if possible
92 if (gb != nullptr)
93 {
94 switch (gb->GetCommandLetter())
95 {
96 case 'E':
97 reply.cat("meta command: ");
98 break;
99
100 case 'G':
101 case 'M':
102 case 'T':
103 if (gb->HasCommandNumber())
104 {
105 if (gb->GetCommandFraction() >= 0)
106 {
107 reply.catf("%c%d.%d: ", gb->GetCommandLetter(), gb->GetCommandNumber(), gb->GetCommandFraction());
108
109 }
110 else
111 {
112 reply.catf("%c%d: ", gb->GetCommandLetter(), gb->GetCommandNumber());
113 }
114 }

Callers 12

StartNextGCodeMethod · 0.80
DoFilePrintMethod · 0.80
ActOnCodeMethod · 0.80
ProcessAbortCommandMethod · 0.80
DisplayMessageBoxMethod · 0.80
ExchangeDataMethod · 0.80
RepRap.cppFile · 0.80
CreateFilamentMonitorMethod · 0.80
DeleteFilamentMonitorMethod · 0.80
SpinMethod · 0.80

Calls 8

copyMethod · 0.80
catfMethod · 0.80
catMethod · 0.80
ClearMethod · 0.45
GetCommandLetterMethod · 0.45
HasCommandNumberMethod · 0.45
GetCommandFractionMethod · 0.45
GetCommandNumberMethod · 0.45

Tested by

no test coverage detected