Fix "ReferenceError: opts is not defined" when throwing an Error