Skip to content

Commit

Permalink
Merge pull request #23 from CMSgov/invalid-format-type
Browse files Browse the repository at this point in the history
Error message with invalid format type
  • Loading branch information
shaselton-usds authored Oct 31, 2024
2 parents 52f673f + 6b41ce9 commit ac853eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
validateJson,
} from "hpt-validator"
import { ValidationResult } from "hpt-validator/src/types"
import { InvalidArgumentError } from "commander"

type FileFormat = "csv" | "json"

Expand All @@ -19,9 +18,10 @@ export async function validate(
) {
const format = getFileFormat(filepath, options)
if (!format) {
throw new InvalidArgumentError(
`Unable to parse format from arguments or filepath: ${filepath}`
console.error(
`This is not a valid file type. Files must be in a required CMS template format (.json or .csv)`
)
return
}

const inputStream = fs.createReadStream(filepath, "utf-8")
Expand Down

0 comments on commit ac853eb

Please sign in to comment.