inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.02k stars 712 forks source link

postConstruct inconsistency for sync and async #1545

Open ehsan2003 opened 9 months ago

ehsan2003 commented 9 months ago

Expected Behavior

post construct should act consistently for both async and sync post constructor functions

Current Behavior

it reshapes the errors of the synchronous post constructor while leaving the errors of async ones as is

Possible Solution

change the code that runs the post constructor and add an await like

Steps to Reproduce (for bugs)

  1. create two separated classes one with synchronous and one with asynchronous postConstructor
  2. throw error from both of them
  3. see how they are different

Context

Well to be honest my problem is way worth I have a very very strange usecase and in my specific situation there are unhandled rejections after an error comes out of the method with postConstruct decorator but I can't really reproduce it to show how it is and I think fixing this issue will fix that too

Your Environment

Stack trace