flasher: Implement proper error-checking