Add context to error message
All checks were successful
Tests / sdk_tests (pull_request) Successful in 21m42s

This commit is contained in:
neeraj 2024-04-02 16:46:17 +05:30
parent 73bef00dd3
commit b5c8a5bf6a
2 changed files with 7 additions and 6 deletions

View File

@ -54,7 +54,7 @@ import {
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.';
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd';
// Parse Tx response from cosmos-sdk.
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
@ -117,7 +117,8 @@ export class Registry {
console.error(error)
}
return errorMessage || DEFAULT_WRITE_ERROR;
const [lastErrorLine] = error.split("\n").slice(-1);
return `${errorMessage || DEFAULT_WRITE_ERROR}: ${lastErrorLine}`;
}
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {

View File

@ -81,10 +81,10 @@ export const parseMsgSetRecordResponse = (data: string) => {
}
export const NAMESERVICE_ERRORS = [
'Name already reserved.',
'Authority bond not found.',
'Name authority not found.',
'Access denied.',
'Name already reserved',
'Authority bond not found',
'Name authority not found',
'Access denied',
]
export interface MessageMsgReserveAuthority {