ensure more informative errors from `dmg.rb`

The logic for better errors was already there; this just makes
sure that another exceptional case is handled, and falls through
to the existing error-check.

References: #4857