I'd comfort them but if the dog is in pain, I'd try to convince them to let him go. It's awful, but you can't explain to the dog (or any pet) why you're putting them through a treatement, etc. and generally they don't get but a few months longer. This is a favorite poem of mine. While very sad, I think it speaks volumes.
If it should be that I grow weak
and pain should keep me from my sleep.
Then you must do what must be done,
for this last battle cannot be won.
You will be sad, I understand.
Don't let your grief then stay your hand.
For this day more than all the rest,
your love for me must stand the test.
We've had so many happy years,
what is to come can hold no fears.
You'd not want me to suffer so.
The time has come, please let me go.
Take me where my needs they'll tend
and please stay with me until the end.
Hold me firm and speak to me,
until my eyes no longer see.
I know in time that you will see,
the kindness that you did for me.
Although my tail its last has waved,
from pain and suffering I've been saved.
Please do not grieve it must be you
who had this painful thing to do.
We've been so close, we two, these years.
Don't let your heart hold back its tears.