Commit 291114ab authored by yann300's avatar yann300

throw in getContext

parent e19c9a3c
...@@ -21,7 +21,13 @@ module.exports = function copyToClipboard (getContent, tip = 'Copy value to to c ...@@ -21,7 +21,13 @@ module.exports = function copyToClipboard (getContent, tip = 'Copy value to to c
copyIcon.onmouseleave = function (event) { copyIcon.style.color = styles.remix.icon_Color_CopyToClipboard } copyIcon.onmouseleave = function (event) { copyIcon.style.color = styles.remix.icon_Color_CopyToClipboard }
copyIcon.onclick = (event) => { copyIcon.onclick = (event) => {
event.stopPropagation() event.stopPropagation()
var copiableContent = getContent() var copiableContent
try {
copiableContent = getContent()
} catch (e) {
addTooltip(e.message)
return
}
if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory if (copiableContent) { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
try { try {
if (typeof copiableContent !== 'string') { if (typeof copiableContent !== 'string') {
...@@ -29,12 +35,8 @@ module.exports = function copyToClipboard (getContent, tip = 'Copy value to to c ...@@ -29,12 +35,8 @@ module.exports = function copyToClipboard (getContent, tip = 'Copy value to to c
} }
} catch (e) {} } catch (e) {}
copy(copiableContent) copy(copiableContent)
if (copiableContent === 'cannot encode arguments') {
addTooltip(copiableContent)
} else {
addTooltip(tip) addTooltip(tip)
} }
} }
}
return copyIcon return copyIcon
} }
...@@ -163,7 +163,7 @@ class MultiParamManager { ...@@ -163,7 +163,7 @@ class MultiParamManager {
encodeObj = txFormat.encodeData(this.funABI, multiJSON) encodeObj = txFormat.encodeData(this.funABI, multiJSON)
} }
if (encodeObj.error) { if (encodeObj.error) {
return encodeObj.error throw new Error(encodeObj.error)
} else { } else {
return encodeObj.data return encodeObj.data
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment