Skip to content

Commit

Permalink
fix: ping-package - add new unknown host pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
luizchaves committed Sep 1, 2024
1 parent b9b19fc commit 673116b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion public/codes/expressjs/system-call/ping-package/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ app.post('/ping', async (req, res) => {
try {
const pingResult = await ping.promise.probe(host);

if (pingResult.output.includes('Name or service not known')) {
if (
['Name or service not known', 'Unknown host'].some((msg) =>
pingResult.output.includes(msg)
)
) {
throw new Error('Unknown host');
}

Expand Down

0 comments on commit 673116b

Please sign in to comment.