1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

add user rejected errors

This commit is contained in:
Erik Marks 2019-09-17 09:36:09 -07:00
parent 79e0a9c1a6
commit 672ade33a6
4 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
const { errors: rpcErrors } = require('eth-json-rpc-errors')
const createId = require('./random-id')
/**
@ -82,7 +83,7 @@ module.exports = class MessageManager extends EventEmitter {
case 'signed':
return resolve(data.rawSig)
case 'rejected':
return reject(new Error('MetaMask Message Signature: User denied message signature.'))
return reject(rpcErrors.eth.userRejectedRequest('MetaMask Message Signature: User denied message signature.'))
default:
return reject(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`))
}

View File

@ -1,6 +1,7 @@
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
const { errors: rpcErrors } = require('eth-json-rpc-errors')
const createId = require('./random-id')
const hexRe = /^[0-9A-Fa-f]+$/g
const log = require('loglevel')
@ -88,7 +89,7 @@ module.exports = class PersonalMessageManager extends EventEmitter {
case 'signed':
return resolve(data.rawSig)
case 'rejected':
return reject(new Error('MetaMask Message Signature: User denied message signature.'))
return reject(rpcErrors.eth.userRejectedRequest('MetaMask Message Signature: User denied message signature.'))
default:
return reject(new Error(`MetaMask Message Signature: Unknown problem: ${JSON.stringify(msgParams)}`))
}

View File

@ -2,6 +2,7 @@ const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const createId = require('./random-id')
const assert = require('assert')
const { errors: rpcErrors } = require('eth-json-rpc-errors')
const sigUtil = require('eth-sig-util')
const log = require('loglevel')
const jsonschema = require('jsonschema')
@ -78,7 +79,7 @@ module.exports = class TypedMessageManager extends EventEmitter {
case 'signed':
return resolve(data.rawSig)
case 'rejected':
return reject(new Error('MetaMask Message Signature: User denied message signature.'))
return reject(rpcErrors.eth.userRejectedRequest('MetaMask Message Signature: User denied message signature.'))
case 'errored':
return reject(new Error(`MetaMask Message Signature: ${data.error}`))
default:

View File

@ -85,7 +85,7 @@
"eth-block-tracker": "^4.4.2",
"eth-contract-metadata": "^1.9.2",
"eth-ens-namehash": "^2.0.8",
"eth-json-rpc-errors": "^1.0.1",
"eth-json-rpc-errors": "^1.1.0",
"eth-json-rpc-filters": "^4.1.0",
"eth-json-rpc-infura": "^4.0.1",
"eth-json-rpc-middleware": "^4.2.0",