-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node): don't throw unhandled exception if version check failed
- Loading branch information
Showing
5 changed files
with
33 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env node | ||
/* eslint-disable import/extensions */ | ||
import { Node, CompilerHttp } from '../../es/index.mjs'; | ||
import { pause } from '../../es/utils/other.mjs'; | ||
/* eslint-enable import/extensions */ | ||
|
||
const invalidUrl = 'https://404.aeternity.io'; | ||
const compiler = new CompilerHttp(invalidUrl); | ||
const node = new Node(invalidUrl); | ||
|
||
await pause(2000); | ||
|
||
const message1 = await compiler.version().catch((error) => error.message); | ||
const message2 = await node.getStatus().catch((error) => error.message); | ||
if (message1 !== message2 || message2 !== 'getaddrinfo ENOTFOUND 404.aeternity.io') { | ||
throw new Error('Invalid exception'); | ||
} | ||
|
||
console.log('Failure of version check doesn\'t emit unhandled exception'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters