Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo Site: Custom Server: Improve error handling #2617

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

nsams
Copy link
Member

@nsams nsams commented Oct 9, 2024

Adapt to next docs https://nextjs.org/docs/pages/building-your-application/configuring/custom-server

see inline comments for the 3 changes I made (the rest is just formatting by prettier)

@nsams nsams requested a review from johnnyomair October 9, 2024 09:20
@nsams nsams self-assigned this Oct 9, 2024
})
.listen(port, () => {
// eslint-disable-next-line no-console
console.log(`> Ready on http://localhost:${port}`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log Ready message in callback (else it is printed before it is actually ready)

.catch((error) => console.error(error));
.once("error", (err) => {
console.error(err);
process.exit(1);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle error by exiting, for example when port is not available

})
.catch((error) => console.error(error));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this catch

@johnnyomair johnnyomair merged commit b9f5dfc into main Oct 9, 2024
11 checks passed
@johnnyomair johnnyomair deleted the demo-site-server-error-handling branch October 9, 2024 15:09
johnnyomair pushed a commit to vivid-planet/comet-starter that referenced this pull request Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants