(#20920) Include file and line number on invalid resource relationship

Change the error type to ResourceError to make it include the file name
and line number.