A simple string check should solve the problem. Here's one that I just experienced:
Error: Sign in to confirm your age
at exports.playError (/home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/utils.js:155:12)
at downloadFromInfoCallback (/home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/index.js:73:19)
at /home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/index.js:20:5
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
MUSIC - [INFO] Musical Modron: buffering -> idle
Song errored
Song errored out, downloading song from 315ms, 43s, 1m, 0h (315)
Options:
{ filter: 'audioonly', begin: '315ms, 43s, 1m, 0h' }
MUSIC - [INFO] Musical Modron: idle -> buffering
MUSIC - [WARN] Musical Modron encountered an error:
Error: Sign in to confirm your age
at exports.playError (/home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/utils.js:155:12)
at downloadFromInfoCallback (/home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/index.js:73:19)
at /home/pi/bots/CAROLINE/node_modules/ytdl-core/lib/index.js:20:5
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
MUSIC - [INFO] Musical Modron: buffering -> idle
Song errored
Song errored out, downloading song from 354ms, 43s, 1m, 0h (354)
Options:
{ filter: 'audioonly', begin: '354ms, 43s, 1m, 0h' }