express icon indicating copy to clipboard operation
express copied to clipboard

fix: async error handling in view rendering

Open Abdel-Monaam-Aouini opened this issue 8 months ago • 1 comments

PR Description: Fix async error handling in view rendering This PR addresses an issue with error handling in the tryRender function related to async/await operations. The original implementation only properly handled synchronous errors, while errors occurring asynchronously in the view.render process could be missed. The fix properly wraps the callback with explicit error handling to ensure both sync and async errors are caught and properly propagated to the calling function. Changes:

  1. Modified the tryRender function to explicitly handle errors from the view render callback
  2. Ensures proper error propagation in asynchronous code paths
  3. Maintains the existing synchronous error handling capability

Abdel-Monaam-Aouini avatar Apr 28 '25 14:04 Abdel-Monaam-Aouini

This PR addresses an issue with error handling in the tryRender function related to async/await operations.

I don't see any change here that has anything to do with async functions or Promises. What is the problem that you're trying to solve (code example would be best)? Your tests pass even without this change (because it seems to do exactly nothing) and lib/application.js already has 100% line coverage.

It looks like your change is more or less view.render(options, callback) => view.render(options, (err, result) => callback(err, result)) and only introduces a small overhead.

krzysdz avatar May 03 '25 20:05 krzysdz