[#82063658] Standardize error handling

Being specific about where the errors are raised so that clients can rescue the correct error.

-- CT
It might not hurt to interpolate the `filename` in here for consumers of the error.