File size: 789 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class UnknownUsageError extends Error {
  /**
   * @param {import('jscodeshift').CallExpression} callExpression
   * @param {string} filePath
   */
  constructor(callExpression, filePath) {
    super('')
    this.message = this.buildMessage(callExpression, filePath)
    this.name = 'UnknownUsageError'
  }

  /**
   *
   * @param {import('jscodeshift').CallExpression} callExpression
   * @param {string} filePath
   * @returns {string}
   */
  buildMessage(callExpression, filePath) {
    const location = callExpression.callee.loc
    const start = location.start.line
    const end = location.end.line

    return `The usage in file "${filePath}" at line ${start}:${end} could not be transformed into the new syntax. Please do this manually.`
  }
}

module.exports = UnknownUsageError