A person sat late in the night with Allah's Apostle ﷺ, and then came to his family and found that his children had gone to sleep. His wife brought food for him. but he took an oath that he would not eat because of his children (having gone to sleep without food) He then gave precedence (of breaking the vow and then expiating it) and ate the food He then came to Allah s Messenger ﷺ and made mention of that to him, whereupon Messenger of Allah (may peace he upon him) said: He who took an oath and (later on) found something better than that should do that, and expiate for (breaking) his vow. (Using translation from Muslim 1650a)
اعْتَمَّ رَجُلٌ عِنْدَ النَّبِيِّ ﷺ ثُمَّ رَجَعَ إِلَى أَهْلِهِ فَوَجَدَ الصِّبْيَةَ قَدْ نَامُوا فَأَتَاهُ أَهْلُهُ بِطَعَامٍ فَحَلَفَ أَنْ لَا يَأْكُلَ مِنْ أَجْلِ صِبْيَتِهِ ثُمَّ بَدَا لَهُ فَأَكَلَ فَأَتَيَا رَسُولَ اللهِ ﷺ فَذَكَرَا ذَلِكَ لَهُ فَقَالَ رَسُولُ اللهِ ﷺ مَنْ حَلَفَ عَلَى يَمِينٍ فَرَأَى غَيْرَهَا خَيْرًا مِنْهَا فَلْيَأْتِهَا وَلْيُكَفِّرْ عَنْ يَمِينِهِ