OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.messages; | 5 library dartino_compiler.messages; |
6 | 6 |
7 import 'diagnostic.dart' show | 7 import 'diagnostic.dart' show |
8 Diagnostic, // For documentation only. | 8 Diagnostic, // For documentation only. |
9 DiagnosticParameter; | 9 DiagnosticParameter; |
10 | 10 |
11 enum DiagnosticKind { | 11 enum DiagnosticKind { |
12 agentVersionMismatch, | 12 agentVersionMismatch, |
13 busySession, | 13 busySession, |
14 cantPerformVerbIn, | 14 cantPerformVerbIn, |
15 cantPerformVerbTo, | 15 cantPerformVerbTo, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 case DiagnosticKind.verbRequiresSocketTarget: | 144 case DiagnosticKind.verbRequiresSocketTarget: |
145 // TODO(ahe): Be more explicit about what is wrong with the target. | 145 // TODO(ahe): Be more explicit about what is wrong with the target. |
146 return "Can't perform '$verb' without a socket, but got '$target', " | 146 return "Can't perform '$verb' without a socket, but got '$target', " |
147 "which is not a socket. Try adding 'tcp_socket' in front."; | 147 "which is not a socket. Try adding 'tcp_socket' in front."; |
148 | 148 |
149 case DiagnosticKind.verbDoesNotSupportTarget: | 149 case DiagnosticKind.verbDoesNotSupportTarget: |
150 return "'$verb' can't be performed on '$target'."; | 150 return "'$verb' can't be performed on '$target'."; |
151 | 151 |
152 case DiagnosticKind.noSuchSession: | 152 case DiagnosticKind.noSuchSession: |
153 return "Couldn't find a session called '$sessionName'. " | 153 return "Couldn't find a session called '$sessionName'. " |
154 "Try running 'fletch create session $sessionName'."; | 154 "Try running 'dartino create session $sessionName'."; |
155 | 155 |
156 case DiagnosticKind.sessionAlreadyExists: | 156 case DiagnosticKind.sessionAlreadyExists: |
157 return "Couldn't create session named '$sessionName'; " | 157 return "Couldn't create session named '$sessionName'; " |
158 "A session called $sessionName already exists."; | 158 "A session called $sessionName already exists."; |
159 | 159 |
160 case DiagnosticKind.sessionInvalidState: | 160 case DiagnosticKind.sessionInvalidState: |
161 return "Session '$sessionName' not in a valid state; " | 161 return "Session '$sessionName' not in a valid state; " |
162 "Please stop attached vm, run 'fletch quit' and retry."; | 162 "Please stop attached vm, run 'dartino quit' and retry."; |
163 | 163 |
164 case DiagnosticKind.noFileTarget: | 164 case DiagnosticKind.noFileTarget: |
165 return "No file provided. Try adding <FILE_NAME> to the command line."; | 165 return "No file provided. Try adding <FILE_NAME> to the command line."; |
166 | 166 |
167 case DiagnosticKind.noTcpSocketTarget: | 167 case DiagnosticKind.noTcpSocketTarget: |
168 return "No TCP socket provided. " | 168 return "No TCP socket provided. " |
169 "Try adding 'tcp_socket HOST:PORT' to the command line."; | 169 "Try adding 'tcp_socket HOST:PORT' to the command line."; |
170 | 170 |
171 case DiagnosticKind.expectedAPortNumber: | 171 case DiagnosticKind.expectedAPortNumber: |
172 return "Expected a port number, but got '$userInput'."; | 172 return "Expected a port number, but got '$userInput'."; |
173 | 173 |
174 case DiagnosticKind.noAgentFound: | 174 case DiagnosticKind.noAgentFound: |
175 return "No agent found in this session."; | 175 return "No agent found in this session."; |
176 | 176 |
177 case DiagnosticKind.upgradeInvalidPackageName: | 177 case DiagnosticKind.upgradeInvalidPackageName: |
178 return "A dartino-agent package must have a name of the form\n" | 178 return "A dartino-agent package must have a name of the form\n" |
179 " dartino-agent_<version>_<platform>.deb.\n" | 179 " dartino-agent_<version>_<platform>.deb.\n" |
180 "Try renaming the file to match this pattern."; | 180 "Try renaming the file to match this pattern."; |
181 | 181 |
182 case DiagnosticKind.socketAgentConnectError: | 182 case DiagnosticKind.socketAgentConnectError: |
183 return "Unable to establish connection to Dartino Agent on " | 183 return "Unable to establish connection to Dartino Agent on " |
184 "$address: $message."; | 184 "$address: $message."; |
185 | 185 |
186 case DiagnosticKind.socketVmConnectError: | 186 case DiagnosticKind.socketVmConnectError: |
187 return | 187 return |
188 "Unable to establish connection to Fletch VM on $address: $message."; | 188 "Unable to establish connection to Dartino VM on $address: $message."; |
189 | 189 |
190 case DiagnosticKind.socketAgentReplyError: | 190 case DiagnosticKind.socketAgentReplyError: |
191 return "Received invalid reply from Dartino Agent on $address: $message."; | 191 return "Received invalid reply from Dartino Agent on $address: $message."; |
192 | 192 |
193 case DiagnosticKind.socketVmReplyError: | 193 case DiagnosticKind.socketVmReplyError: |
194 return "Received invalid reply from Fletch VM on $address: $message."; | 194 return "Received invalid reply from Dartino VM on $address: $message."; |
195 | 195 |
196 case DiagnosticKind.attachToVmBeforeRun: | 196 case DiagnosticKind.attachToVmBeforeRun: |
197 return "Unable to run program without being attached to a VM. " | 197 return "Unable to run program without being attached to a VM. " |
198 "Try running 'fletch attach'."; | 198 "Try running 'dartino attach'."; |
199 | 199 |
200 case DiagnosticKind.compileBeforeRun: | 200 case DiagnosticKind.compileBeforeRun: |
201 return "No program to run. Try running 'fletch compile'"; | 201 return "No program to run. Try running 'dartino compile'"; |
202 | 202 |
203 case DiagnosticKind.missingToFile: | 203 case DiagnosticKind.missingToFile: |
204 return "No destination file provided. " | 204 return "No destination file provided. " |
205 "Try adding 'to <FILE_NAME>' to the command line"; | 205 "Try adding 'to <FILE_NAME>' to the command line"; |
206 | 206 |
207 case DiagnosticKind.unknownOption: | 207 case DiagnosticKind.unknownOption: |
208 // TODO(lukechurch): Review UX. | 208 // TODO(lukechurch): Review UX. |
209 return "Unknown option: '$userInput'."; | 209 return "Unknown option: '$userInput'."; |
210 | 210 |
211 case DiagnosticKind.unsupportedPlatform: | 211 case DiagnosticKind.unsupportedPlatform: |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 "isn't a bool, int, or String."; | 271 "isn't a bool, int, or String."; |
272 | 272 |
273 case DiagnosticKind.settingsUnrecognizedKey: | 273 case DiagnosticKind.settingsUnrecognizedKey: |
274 return "$uri: unexpected key '$userInput'."; | 274 return "$uri: unexpected key '$userInput'."; |
275 | 275 |
276 case DiagnosticKind.settingsDeviceAddressNotAString: | 276 case DiagnosticKind.settingsDeviceAddressNotAString: |
277 return "$uri: 'device_address' value '$userInput' isn't a String."; | 277 return "$uri: 'device_address' value '$userInput' isn't a String."; |
278 | 278 |
279 case DiagnosticKind.unknownAction: | 279 case DiagnosticKind.unknownAction: |
280 return "'$userInput' isn't a supported action. " | 280 return "'$userInput' isn't a supported action. " |
281 "Try running 'fletch help'."; | 281 "Try running 'dartino help'."; |
282 | 282 |
283 case DiagnosticKind.extraArguments: | 283 case DiagnosticKind.extraArguments: |
284 return "Unrecognized arguments: $userInput."; | 284 return "Unrecognized arguments: $userInput."; |
285 | 285 |
286 case DiagnosticKind.duplicatedIn: | 286 case DiagnosticKind.duplicatedIn: |
287 return "More than one 'in' clause: $preposition."; | 287 return "More than one 'in' clause: $preposition."; |
288 | 288 |
289 case DiagnosticKind.duplicatedTo: | 289 case DiagnosticKind.duplicatedTo: |
290 // TODO(ahe): This is getting a bit tedious by now. We really need to | 290 // TODO(ahe): This is getting a bit tedious by now. We really need to |
291 // figure out if we need to require exact prepostions. | 291 // figure out if we need to require exact prepostions. |
(...skipping 19 matching lines...) Expand all Loading... |
311 | 311 |
312 case DiagnosticKind.verbRequiresSpecificTargetButGot: | 312 case DiagnosticKind.verbRequiresSpecificTargetButGot: |
313 return "Can't perform '$verb' without a '$requiredTarget', " | 313 return "Can't perform '$verb' without a '$requiredTarget', " |
314 "but got: '$target'."; | 314 "but got: '$target'."; |
315 | 315 |
316 case DiagnosticKind.expectedTargetButGot: | 316 case DiagnosticKind.expectedTargetButGot: |
317 return "Expected 'session(s)', 'class(s)', 'method(s)', 'file(s)', " | 317 return "Expected 'session(s)', 'class(s)', 'method(s)', 'file(s)', " |
318 "or 'all', but got: '$userInput'. Did you mean 'file $userInput'?"; | 318 "or 'all', but got: '$userInput'. Did you mean 'file $userInput'?"; |
319 | 319 |
320 case DiagnosticKind.quitTakesNoArguments: | 320 case DiagnosticKind.quitTakesNoArguments: |
321 return "Unexpected arguments. Try running 'fletch quit'."; | 321 return "Unexpected arguments. Try running 'dartino quit'."; |
322 | 322 |
323 case DiagnosticKind.busySession: | 323 case DiagnosticKind.busySession: |
324 return "Session '$sessionName' is in use, please try again shortly."; | 324 return "Session '$sessionName' is in use, please try again shortly."; |
325 | 325 |
326 case DiagnosticKind.terminatedSession: | 326 case DiagnosticKind.terminatedSession: |
327 return "Session '$sessionName' was terminated."; | 327 return "Session '$sessionName' was terminated."; |
328 | 328 |
329 case DiagnosticKind.handShakeFailed: | 329 case DiagnosticKind.handShakeFailed: |
330 // TODO(ager): lukechurch: Should this ever happen during normal usage? | 330 // TODO(ager): lukechurch: Should this ever happen during normal usage? |
331 // Should they report this to us as a bug? | 331 // Should they report this to us as a bug? |
(...skipping 14 matching lines...) Expand all Loading... |
346 // can go to do that? Are we considering adding a tool to auto-upgrade? | 346 // can go to do that? Are we considering adding a tool to auto-upgrade? |
347 return """ | 347 return """ |
348 Could not start vm on device because the compiler and the | 348 Could not start vm on device because the compiler and the |
349 session's remote device have different versions. | 349 session's remote device have different versions. |
350 Compiler version: '$userInput' | 350 Compiler version: '$userInput' |
351 Device version: '$additionalUserInput'. | 351 Device version: '$additionalUserInput'. |
352 $fixit"""; | 352 $fixit"""; |
353 | 353 |
354 case DiagnosticKind.compilerVersionMismatch: | 354 case DiagnosticKind.compilerVersionMismatch: |
355 return "Command failed because the running compiler and the " | 355 return "Command failed because the running compiler and the " |
356 "Fletch Command Line Interface (CLI) have " | 356 "Dartino Command Line Interface (CLI) have " |
357 "different versions.\nCompiler version: '$userInput'\n" | 357 "different versions.\nCompiler version: '$userInput'\n" |
358 "CLI version: '$additionalUserInput'.\n" | 358 "CLI version: '$additionalUserInput'.\n" |
359 "This can happen if you have recently updated you Fletch SDK. " | 359 "This can happen if you have recently updated you Dartino SDK. " |
360 "Try running 'fletch quit' and retry the command."; | 360 "Try running 'dartino quit' and retry the command."; |
361 | 361 |
362 case DiagnosticKind.illegalDefine: | 362 case DiagnosticKind.illegalDefine: |
363 return "The define $userInput has an illegal value part: " | 363 return "The define $userInput has an illegal value part: " |
364 "$additionalUserInput."; | 364 "$additionalUserInput."; |
365 } | 365 } |
366 } | 366 } |
OLD | NEW |