dbt-coverage icon indicating copy to clipboard operation
dbt-coverage copied to clipboard

add error handling for manifest.json and catalog.json not found

Open bbrewington opened this issue 1 year ago • 2 comments

fixes #41

bbrewington avatar Oct 20 '22 01:10 bbrewington

May need to tweak formatting...add newline in the error message for the manifest one?

Here's test code + output:

>>> from pathlib import Path
>>> import dbt_coverage as dc
>>> dc.load_catalog(Path('asdf'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/brentbrewington/github/dbt-coverage/dbt_coverage/__init__.py", line 510, in load_catalog
    raise FileNotFoundError("target/catalog.json not found - "
FileNotFoundError: target/catalog.json not found - before using dbt-coverage, run: dbt docs generate
>>> dc.load_manifest(Path('asdf'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/brentbrewington/github/dbt-coverage/dbt_coverage/__init__.py", line 526, in load_manifest
    raise FileNotFoundError(f"target/manifest.json not found - "
FileNotFoundError: target/manifest.json not found - before using dbt-coverage, run a dbt command that creates manifest artifact (see: https://docs.getdbt.com/reference/artifacts/manifest-json)

bbrewington avatar Oct 20 '22 01:10 bbrewington

@mrshu ready for review! see comment above

bbrewington avatar Oct 20 '22 01:10 bbrewington

Looks good to me, thanks @bbrewington!

mrshu avatar Nov 02 '22 14:11 mrshu