Uploaded image for project: 'Magnolia CLI'
  1. Magnolia CLI
  2. NPMCLI-32

Provide better error handling when files are empty

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 2.0
    • None
    • None

    Description

      To reproduce

      • create a light module called e.g. my-module
      • create an empty page template definition at my-module/templates/pages/super-page.yam (this can easily happen if a dev doesn't use the create-page command)
      • run mgnl add-availability my-module:components/my-comp my-module:pages/super-page@main -p my-module/
        The following error is thrown, which is probably not very useful for an average CLI user
        path.js:7
            throw new TypeError('Path must be a string. Received ' + inspect(path));
            ^
        TypeError: Path must be a string. Received null
            at assertPath (path.js:7:11)
            at Object.join (path.js:1251:7)
            at modifyYamlConfiguration (/Users/fgrilli/devel/workspace/magnolia/build/npm-cli/bin/addAvailability.js:71:35)
            at /Users/fgrilli/devel/workspace/magnolia/build/npm-cli/bin/addAvailability.js:65:5
            at tryToString (fs.js:414:3)
            at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:401:12)
        

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                fgrilli Federico Grilli
                fgrilli Federico Grilli
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD