mirror of
https://github.com/codex-storage/cli.git
synced 2025-02-28 08:30:41 +00:00
error handling in node status
This commit is contained in:
parent
59de2c6755
commit
b2a08f9d37
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
node_modules
|
||||
datadir
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
|
11
index.js
Normal file → Executable file
11
index.js
Normal file → Executable file
@ -173,6 +173,12 @@ async function checkNodeStatus() {
|
||||
}
|
||||
|
||||
try {
|
||||
// Check if a Codex node is already running
|
||||
const nodeRunning = await isNodeRunning();
|
||||
|
||||
if (nodeRunning) {
|
||||
console.log(chalk.green('A Codex node is already running.'));
|
||||
await showNavigationMenu();
|
||||
const spinner = createSpinner('Checking node status...').start();
|
||||
const response = await runCommand('curl http://localhost:8080/api/codex/v1/debug/info -w \'\\n\'');
|
||||
spinner.success();
|
||||
@ -224,6 +230,11 @@ async function checkNodeStatus() {
|
||||
|
||||
console.log('━'.repeat(50));
|
||||
await showNavigationMenu();
|
||||
}
|
||||
else{
|
||||
console.log(chalk.red('\nOops...Codex node is not running. Try again after starting the node in port 8080'));
|
||||
await showNavigationMenu();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(chalk.red('Failed to check node status:', error.message));
|
||||
await showNavigationMenu();
|
||||
|
Loading…
x
Reference in New Issue
Block a user