function readPolicyFileSync({ debugMode, policyPath }) {
  if (debugMode) {
    console.warn(`Lavamoat looking for policy at '${policyPath}'`)
  }
  /** @type string */
  let rawPolicy
  try {
    rawPolicy = readFileSync(policyPath, 'utf8')
  } catch (err) {
    if (/** @type {NodeJS.ErrnoException} */ (err).code !== 'ENOENT') {
      throw err
    } else if (debugMode) {
      console.warn(`Lavamoat could not find policy at '${policyPath}'`)
    }
    return
  }
  try {
    return JSON.parse(rawPolicy)
  } catch (/** @type any */ error) {
    if (debugMode) {
      console.warn({
        error: error?.message || error,
        policyPath,
        rawPolicy,
      })
    }
    throw new Error(
      `Lavamoat could not parse policy at '${policyPath}': ${/** @type {NodeJS.ErrnoException} */ (error).message}`
    )
  }
}
Reads a policy file from disk, if present

@param {PolicyOpts} opts
@returns {import('./schema').LavaMoatPolicy | undefined}