Recently, while upgrading an iPod Touch to iOS 5, I received the following:?an error occurred while restoring this ipod (-34). While I don’t know what caused the error, my resolution was to connect the device to my computer using a the USB cable, then press and hold the home and power buttons until the count of 10. Release the power button, but continue to hold down the home button. iTunes should recognize your device in recovery mode, and offer the option to restore. This should restore your device to the fresh iOS 5 state, where you can then recover your latest backup, sync, etc.
image credit: odolphie