I'm trying to install all packages of a file in Arch Linux with the following command:

yay -S --noconfirm --norebuild - < "$DIR"/pkglist.txt

However, when a program fails, the rest of the packages aren't installed. How can I make sure all the programs that don't fail are installed and print an error at the end for the ones that failed?