| 325 | } |
| 326 | |
| 327 | char *fmt_splice_script_compiler_error(const tal_t *ctx, |
| 328 | const char *script, |
| 329 | struct splice_script_error *error) |
| 330 | { |
| 331 | switch (error->type) { |
| 332 | case INTERNAL_ERROR: |
| 333 | return tal_fmt(ctx, "Internal error\n%s", |
| 334 | context_snippet(ctx, script, error)); |
| 335 | case INVALID_TOKEN: |
| 336 | return tal_fmt(ctx, "Invalid token error\n%s", |
| 337 | context_snippet(ctx, script, error)); |
| 338 | case DEBUG_DUMP: |
| 339 | return tal_fmt(ctx, "Token Dump:\n%s", error->message); |
| 340 | case TOO_MANY_PIPES: |
| 341 | return tal_fmt(ctx, "Too many '%c' symbols near here\n%s", |
| 342 | PIPE_SYMBOL, |
| 343 | context_snippet(ctx, script, error)); |
| 344 | case TOO_MANY_ATS: |
| 345 | return tal_fmt(ctx, "Too many '%c' symbols near here\n%s", |
| 346 | AT_SYMBOL, |
| 347 | context_snippet(ctx, script, error)); |
| 348 | case TOO_MANY_COLONS: |
| 349 | return tal_fmt(ctx, "Too many '%c' symbols near here\n%s", |
| 350 | COLON_SYMBOL, |
| 351 | context_snippet(ctx, script, error)); |
| 352 | case TOO_MANY_PLUS: |
| 353 | return tal_fmt(ctx, "Too many '%c' symbols near here\n%s", |
| 354 | PLUS_SYMBOL, |
| 355 | context_snippet(ctx, script, error)); |
| 356 | case TOO_MANY_MINUS: |
| 357 | return tal_fmt(ctx, "Too many '%c' symbols near here\n%s", |
| 358 | MINUS_SYMBOL, |
| 359 | context_snippet(ctx, script, error)); |
| 360 | case INVALID_NODEID: |
| 361 | return tal_fmt(ctx, "Invalid node id\n%s", |
| 362 | context_snippet(ctx, script, error)); |
| 363 | case INVALID_CHANID: |
| 364 | return tal_fmt(ctx, "Invalid channel id\n%s", |
| 365 | context_snippet(ctx, script, error)); |
| 366 | case WRONG_NUM_SEGMENT_CHUNKS: |
| 367 | return tal_fmt(ctx, "Segments must have one or two \"" |
| 368 | ARROW_SYMBOL "\" symbols\n%s", |
| 369 | context_snippet(ctx, script, error)); |
| 370 | case MISSING_ARROW: |
| 371 | return tal_fmt(ctx, "Segments elements must be separated by \"" |
| 372 | ARROW_SYMBOL "\" symbols\n%s", |
| 373 | context_snippet(ctx, script, error)); |
| 374 | case NO_MATCHING_NODES: |
| 375 | return tal_fmt(ctx, "No matching nodes for node query\n%s", |
| 376 | context_snippet(ctx, script, error)); |
| 377 | case INVALID_INDEX: |
| 378 | return tal_fmt(ctx, "Valid index must be only number digits" |
| 379 | " and no other characters\n%s", |
| 380 | context_snippet(ctx, script, error)); |
| 381 | case CHAN_INDEX_ON_WILDCARD_NODE: |
| 382 | return tal_fmt(ctx, "Node wildcard matches must use an index," |
| 383 | " '%c', or '%c' after the '%c'\n%s", |
| 384 | Q_SYMBOL, WILD_SYMBOL, COLON_SYMBOL, |