agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
22 lines (20 loc) • 522 B
JavaScript
/**
* @file Check if code is in try-catch block
* @description Single responsibility: Determine if code is wrapped in a try-catch block
*/
/**
* Check if code is in a try-catch block
* @param {Object} path - AST path context
* @returns {boolean} True if in try-catch
*/
function isInTryCatch(path) {
let current = path;
while (current) {
if (current.node && current.node.type === 'TryStatement') {
return true;
}
current = current.parent;
}
return false;
}
module.exports = isInTryCatch;