forked from cerc-io/laconic-sdk
Add context to error message (#57)
Part of [Fix error propagation from laconicd to client SDK](https://www.notion.so/Fix-error-propagation-from-laconicd-to-client-SDK-1bd20c5a4e8141a99e5809ea1fd7832f) - Use error in response raw log from laconicd Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: cerc-io/laconic-sdk#57
This commit is contained in:
parent
73bef00dd3
commit
3dabf399f7
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/laconic-sdk",
|
"name": "@cerc-io/laconic-sdk",
|
||||||
"version": "0.1.15",
|
"version": "0.1.16",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||||
|
@ -54,7 +54,7 @@ import {
|
|||||||
|
|
||||||
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
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.
|
// Parse Tx response from cosmos-sdk.
|
||||||
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
export const parseTxResponse = (result: any, parseResponse?: (data: string) => any) => {
|
||||||
@ -117,7 +117,8 @@ export class Registry {
|
|||||||
console.error(error)
|
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) {
|
constructor(gqlUrl: string, restUrl: string = "", chainId: string = DEFAULT_CHAIN_ID) {
|
||||||
|
@ -81,10 +81,10 @@ export const parseMsgSetRecordResponse = (data: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const NAMESERVICE_ERRORS = [
|
export const NAMESERVICE_ERRORS = [
|
||||||
'Name already reserved.',
|
'Name already reserved',
|
||||||
'Authority bond not found.',
|
'Authority bond not found',
|
||||||
'Name authority not found.',
|
'Name authority not found',
|
||||||
'Access denied.',
|
'Access denied',
|
||||||
]
|
]
|
||||||
|
|
||||||
export interface MessageMsgReserveAuthority {
|
export interface MessageMsgReserveAuthority {
|
||||||
|
Loading…
Reference in New Issue
Block a user