As is well known, a Magid would come from Shomayim to study with the Bais Yosef zt”l. This Heavenly Magid revealed to him numerous times that he was destined to die al kiddush Hashem.
Rav Yissochor Dov of Belz zy”a quotes his father, Rav Yehoshua of Belz zy”a as asking his father, The Sar Shalom of Belz zy”a why we don’t find that this ever occurred. It seems that the Bais Yosef died peacefully, and was not killed al kiddush Hashem. The Sar Shalom answered that the Bais Yosef was moser nefesh and gave over his soul to Hashem numerous times; however, Hashem had mercy on him and allowed him to live.
The Ohr Hachaim Hakadosh writes that when the pasuk says that the sons of Aharon died “when they came close to Hashem”, this means that they had such dveikus to Hashem that their souls left their bodies. However, the pasuk says about Aharon that he should go to the Kodesh “with this”, meaning with this same level of dveikus and mesiras nefesh, but he was promised that Hashem would have mercy on him and he would not die.