I hear ya!
That is a major annoyance and seems to pop-up when least expected.
So I got an app called: ‘iStat Menu’ which monitors battery life and displays
that info in a drop-down from the menu bar.
Not a ‘real’ solution but does give me a ‘heads-up’.
{‘-’}