( error: Error | CodeError | ValidationError, query: Query )
| 88 | } |
| 89 | |
| 90 | export function augmentFileValidationError( |
| 91 | error: Error | CodeError | ValidationError, |
| 92 | query: Query |
| 93 | ) { |
| 94 | const location = |
| 95 | "location" in error && error.location |
| 96 | ? error.location |
| 97 | : getOverallSourceLocation(query.sourceMap.map(span => span.sourceLocation)) |
| 98 | |
| 99 | const formattedQuery = codeFrameColumns(query.sourceFile.fileContent, location) |
| 100 | |
| 101 | error.name = "ValidationError" |
| 102 | error.message = |
| 103 | format.error( |
| 104 | `Query validation failed in ${formatSourceLink(query.sourceFile.filePath, location)}:` |
| 105 | ) + |
| 106 | `\n\n` + |
| 107 | format.error(`${error.message}`) + |
| 108 | `\n\n` + |
| 109 | formattedQuery |
| 110 | return error |
| 111 | } |
| 112 | |
| 113 | export function augmentQuerySyntaxError( |
| 114 | error: Error, |
no test coverage detected