@injectivelabs/exceptions
Advanced tools
Comparing version 1.0.19 to 1.0.20
@@ -93,3 +93,3 @@ "use strict"; | ||
type: this.type, | ||
contextModule: this.contextCode, | ||
contextModule: this.contextModule, | ||
contextCode: this.contextCode, | ||
@@ -96,0 +96,0 @@ })); |
@@ -6,2 +6,3 @@ "use strict"; | ||
const types_1 = require("../types"); | ||
const maps_1 = require("../utils/maps"); | ||
const removeMetamaskFromErrorString = (message) => message | ||
@@ -18,3 +19,3 @@ .replaceAll('Metamask', '') | ||
const { message } = this; | ||
this.setMessage(removeMetamaskFromErrorString(message)); | ||
this.setMessage((0, maps_1.mapMetamaskMessage)(removeMetamaskFromErrorString(message))); | ||
} | ||
@@ -21,0 +22,0 @@ } |
@@ -7,2 +7,3 @@ import { ErrorContextCode } from '../types'; | ||
}; | ||
export declare const mapMetamaskMessage: (message: string) => string; | ||
//# sourceMappingURL=maps.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mapFailedTransactionMessage = exports.parseMessage = void 0; | ||
exports.mapMetamaskMessage = exports.mapFailedTransactionMessage = exports.parseMessage = void 0; | ||
const messages_1 = require("../messages"); | ||
@@ -21,3 +21,3 @@ const types_1 = require("../types"); | ||
const parsedMessage = (0, exports.parseMessage)(message); | ||
const messageInMapKey = Object.keys(messages_1.chainErrorMessagesMap).find((key) => key.toLowerCase() === parsedMessage.toLowerCase()); | ||
const messageInMapKey = Object.keys(messages_1.chainErrorMessagesMap).find((key) => parsedMessage.toLowerCase().includes(key.toLowerCase())); | ||
if (!messageInMapKey) { | ||
@@ -29,2 +29,10 @@ return { message: parsedMessage, code: types_1.UnspecifiedErrorCode }; | ||
exports.mapFailedTransactionMessage = mapFailedTransactionMessage; | ||
const mapMetamaskMessage = (message) => { | ||
const parsedMessage = message.trim().toLowerCase(); | ||
if (parsedMessage.includes('User denied message signature'.toLowerCase())) { | ||
return 'You have rejected signing the transaction'; | ||
} | ||
return parsedMessage; | ||
}; | ||
exports.mapMetamaskMessage = mapMetamaskMessage; | ||
//# sourceMappingURL=maps.js.map |
{ | ||
"name": "@injectivelabs/exceptions", | ||
"description": "List of exceptions that can be reused throughout Injective's projects.", | ||
"version": "1.0.19", | ||
"version": "1.0.20", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "f267784f4c2c994e9f21ca1190b436c3e6ba7634" | ||
"gitHead": "29d51048dec698e7671254810c068721c622a304" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
141194
2249