import json


def catch_json_error(blob, filepath, **kwargs):
    """Wrapper to provide better error message for JSON reads"""
    try:
        parsed = json.loads(blob, **kwargs)
    except ValueError as e:
        raise ValueError("JSON error reading {}: {}!".format(filepath,
                                                             e.args[0]))

    return parsed