Handle error from GetDevice early

Also more verbose error.

Fixes panic from #7701