( error: Error, path: QueryNodePath<any>, query: Query )
| 124 | } |
| 125 | |
| 126 | export function augmentValidationError( |
| 127 | error: Error, |
| 128 | path: QueryNodePath<any>, |
| 129 | query: Query |
| 130 | ): ValidationError { |
| 131 | const location = |
| 132 | path.type in path.node && "location" in path.node[path.type] |
| 133 | ? mapToSourceLocation(query, path.node[path.type].location) |
| 134 | : getOverallSourceLocation(query.sourceMap.map(span => span.sourceLocation)) |
| 135 | |
| 136 | // tslint:disable-next-line prefer-object-spread |
| 137 | return Object.assign(error, { |
| 138 | name: "ValidationError", |
| 139 | path, |
| 140 | location, |
| 141 | sourceFile: query.sourceFile |
| 142 | }) |
| 143 | } |
| 144 | |
| 145 | export function augmentCodeError( |
| 146 | error: Error, |
no test coverage detected