(logs: string)
| 619 | |
| 620 | // Try to extract useful error messages from the logs |
| 621 | function checkLogsForErrors(logs: string) { |
| 622 | const errors: LogParserOptions = [ |
| 623 | { |
| 624 | regex: /Error: Provided --schema at (?<schema>.*) doesn't exist/, |
| 625 | message: `Prisma generate failed to find the specified schema at "$schema".\nDid you include it in config.additionalFiles? ${terminalLink( |
| 626 | "Config docs", |
| 627 | docs.config.prisma |
| 628 | )}`, |
| 629 | }, |
| 630 | { |
| 631 | regex: /sh: 1: (?<packageOrBinary>.*): not found/, |
| 632 | message: `$packageOrBinary not found\n\nIf it's a package: Include it in ${terminalLink( |
| 633 | "config.additionalPackages", |
| 634 | docs.config.prisma |
| 635 | )}\nIf it's a binary: Please ${terminalLink( |
| 636 | "get in touch", |
| 637 | getInTouch |
| 638 | )} and we'll see what we can do!`, |
| 639 | }, |
| 640 | ]; |
| 641 | |
| 642 | for (const error of errors) { |
| 643 | const matches = logs.match(error.regex); |
| 644 | |
| 645 | if (!matches) { |
| 646 | continue; |
| 647 | } |
| 648 | |
| 649 | const message = getMessageFromTemplate(error.message, matches.groups); |
| 650 | |
| 651 | log.error(`${chalkError("Error:")} ${message}`); |
| 652 | break; |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | function getMessageFromTemplate(template: string, replacer: RegExpMatchArray["groups"]) { |
| 657 | let message = template; |
no test coverage detected
searching dependent graphs…