def _load_package_json(err, package, expectation):
    raw_package_json = package.read('package.json')
    try:
        package_json = json.loads(raw_package_json)
    except ValueError:
        err.error(err_id=('main', 'test_package', 'parse_error'), error='Could not parse `package.json`.', description='The JSON parser was unable to parse the package.json file included with this add-on.', filename='package.json')
    else:
        err.save_resource('has_package_json', True, pushable=True)
        err.save_resource('package_json', package_json, pushable=True)
        err.detected_type = PACKAGE_EXTENSION
def _load_package_json(err, package, expectation):
    raw_package_json = package.read('package.json')
    try:
        package_json = json.loads(raw_package_json)
    except ValueError:
        err.error(err_id=('main', 'test_package', 'parse_error'), error='Could not parse `package.json`.', description='The JSON parser was unable to parse the package.json file included with this add-on.', filename='package.json')
    else:
        err.save_resource('has_package_json', True, pushable=True)
        err.save_resource('package_json', package_json, pushable=True)
        err.detected_type = PACKAGE_EXTENSION