mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
## 🔒 Security Fixes - CRITICAL: Removed vulnerable pkg dependency (GHSA-22r3-9w55-cj54) - Replaced with secure @vercel/ncc alternative - Security score improved from 55/100 to 75/100 - All npm audit vulnerabilities resolved (0 vulnerabilities) ## 🚀 Infrastructure Improvements - Re-enabled ALL CI/CD security gates with strict enforcement - Fixed Jest configuration and test infrastructure - Fixed 18 TypeScript test files with import issues - Created comprehensive test utilities ## 🛠️ Code Quality - Fixed 145 ESLint errors (16% reduction) - Fixed 15 critical TypeScript errors - Added development tooling configs ## 📚 Documentation - Created security audit report - Created fix summary documentation - Created functionality review - Updated GitHub issue #362 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
952 B
TypeScript
39 lines
952 B
TypeScript
/**
|
|
* Utility for proper error handling in TypeScript
|
|
*/
|
|
|
|
import {
|
|
getErrorMessage as getErrorMsg,
|
|
getErrorStack as getErrorStk,
|
|
isError as isErr,
|
|
} from './type-guards.js';
|
|
|
|
export class AppError extends Error {
|
|
constructor(
|
|
message: string,
|
|
public code?: string,
|
|
public statusCode?: number,
|
|
) {
|
|
super(message);
|
|
this.name = 'AppError';
|
|
Object.setPrototypeOf(this, AppError.prototype);
|
|
}
|
|
}
|
|
|
|
// Re-export from type-guards for backward compatibility
|
|
export const isError = isErr;
|
|
export const getErrorMessage = getErrorMsg;
|
|
export const getErrorStack = getErrorStk;
|
|
|
|
export function handleError(error: unknown, context?: string): never {
|
|
const message = getErrorMessage(error);
|
|
const stack = getErrorStack(error);
|
|
|
|
console.error(`Error${context ? ` in ${context}` : ''}: ${message}`);
|
|
if (stack && process.env.NODE_ENV === 'development') {
|
|
console.error('Stack trace:', stack);
|
|
}
|
|
|
|
process.exit(1);
|
|
}
|