Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
A
app
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Site.js
  • app
  • Issues
  • #208

Closed
Open
Opened Jul 03, 2020 by Aral Balkan@aralOwner
  • Report abuse
  • New issue
Report abuse New issue

If a file is specified to serve instead of a directory, handle the error gracefully

Currently, if you erroneously specify a file instead of a directory to serve, the server crashes with the following error:

Jul 03 17:43:44 my-lovely-demo.site site[32756]: (node:32756) UnhandledPromiseRejectionWarning: Error: ENOTDIR: not a directory, scandir '/home/aral/public/index.html'
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Object.readdirSync (fs.js:872:3)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Object.readdirSync (/usr/local/bin/site:181:50)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Site.addHugoSupport (/usr/local/bin/index.js:443:22)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Site.configureAppRoutes (/usr/local/bin/index.js:554:16)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Site.configureApp (/usr/local/bin/index.js:295:18)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at Site.serve (/usr/local/bin/index.js:855:16)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
Jul 03 17:43:44 my-lovely-demo.site site[32756]:     at async /usr/local/bin/bin/commands/serve.js:287:9
Jul 03 17:43:44 my-lovely-demo.site site[32756]: (node:32756) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Jul 03 17:43:44 my-lovely-demo.site site[32756]: (node:32756) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Let’s handle this more gracefully :)

Assignee
Assign to
15.4.0
Milestone
15.4.0 (Past due)
Assign milestone
Time tracking
None
Due date
None
1
Labels
Improvement
Assign labels
  • View project labels
Reference: site.js/app#208

Like this? Fund us! Your patronage helps keep us independent and going.