Skip to content

Commit

Permalink
remove changes since refactored CLI to not throw error for this task
Browse files Browse the repository at this point in the history
  • Loading branch information
dnlbui committed Sep 26, 2024
1 parent 91c2f20 commit c9f8fcd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
12 changes: 0 additions & 12 deletions api/handlers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,8 @@ export default function configureNodeHandlers(apiRouter: Router) {
badRequestResponse(res, 'No address provided');
return;
}


console.log('Executing operator-cli stake_info...');
const output = execFileSync('operator-cli', ['stake_info', address], { encoding: 'utf8' })

// Check for specific error message
// Case where query was valid but no stake info was found
if (output === 'No stake information found. Please fund the account and try again.') {
// Check if the response headers have already been sent
if (!res.headersSent) {
res.status(404).json({ errorMessage: 'Account not found. Please ensure the account has been funded.', errorDetails: '' });
}
return;
}
const yamlData = yaml.load(output);
res.json(yamlData);
})
Expand Down
2 changes: 0 additions & 2 deletions hooks/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const fetcher = async <T>(input: RequestInfo | URL,
const data = await res.json();
if (res.status === 403) {
authService.logout(apiBase);
} else if (input.toString().includes('account') && res.status === 404 && data.errorMessage === `Account not found. Please ensure the account has been funded.`) {
throw new Error('No stake information found. Please fund the account and try again.');
} else if (res.status === 500) {
showErrorMessage('Sorry, something went wrong. Please report this issue to our support team so we can investigate and resolve the problem.');
return;
Expand Down

0 comments on commit c9f8fcd

Please sign in to comment.