[BUGFIX] Check if a valid logger is available in error handlers