Open johnmcdowell opened 6 months ago
I tried to debug the issue with the logs.
I think there is a case here where exec_async can resolve a promise with an undefined value if battery status
prints nothing to stdout. I assume there's an assumption that that should never happen, but how else could message be undefined here?
const is_limiter_enabled = async () => {
try {
const message = await exec_async( `${ battery } status` )
log( `Limiter status message: `, message )
return message.includes( 'being maintained at' )
Just a potential related thought about the logging: I also wonder if there shouldn't be a log entry in the case that the message from battery status_csv
is undefined here, rather than just silently assigning empty values? Though perhaps that doesn't help us understand the root of the issue.
const get_battery_status = async () => {
try {
const message = await exec_async( `${ battery } status_csv` )
let [ percentage='??', remaining='', charging='', discharging='', maintain_percentage='' ] = message?.split( ',' ) || []
All that said, I don't understand if I'm seeing the popup alert after hibernation because of something that needs to be fixed deeper down, or if instead that GUI alert should suppressed in some cases.
Hope this helps.
It happens sporadically, any updates?
Hello, same problem for me I post an attachment with the popup error. The popup appear when my MacBook is plug on my charger but I stop my power bank. I supposed the value is like "Plug on power but no power delivery" I don't know if it's understandable.
What is the issue? (required) Battery app pops up a GUI alert message stating "Battery limiter error: Cannot read properties of undefined (reading 'includes')"
Further, I don't think the app is logging the output of its call to
battery status_csv
in some case where that call does not return expected output.What exactly did you do to produce the issue? (required) Steps to reproduce the behavior:
I'm not sure I can repro this consistently, but the app normally works and the error is intermittent.
Expected behavior (required) Not see a GUI error message at log-in.
Error logs