Logs an error and re-throws it.
Error to log and throw
Optional
Additional context message
Always throws after logging
try { dangerousOperation();} catch (error) { logErrorAndThrow(error, 'Operation failed');} Copy
try { dangerousOperation();} catch (error) { logErrorAndThrow(error, 'Operation failed');}
Logs an error and re-throws it.