Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

unknown-usage-error.cjs

27 lines789 Bytes

1class UnknownUsageError extends Error {
2 /**
3 * @param {import('jscodeshift').CallExpression} callExpression
4 * @param {string} filePath
5 */
6 constructor(callExpression, filePath) {
7 super('')
8 this.message = this.buildMessage(callExpression, filePath)
9 this.name = 'UnknownUsageError'
10 }
11​
12 /**
13 *
14 * @param {import('jscodeshift').CallExpression} callExpression
15 * @param {string} filePath
16 * @returns {string}
17 */
18 buildMessage(callExpression, filePath) {
19 const location = callExpression.callee.loc
20 const start = location.start.line
21 const end = location.end.line
22​
23 return `The usage in file "${filePath}" at line ${start}:${end} could not be transformed into the new syntax. Please do this manually.`
24 }
26​
27module.exports = UnknownUsageError