Json: Provide better error messages for wrong types

This commit is contained in:
Mathias Baumann
2018-12-18 18:36:50 +01:00
parent 4e475cdbe9
commit c43d96f2bf
47 changed files with 330 additions and 13 deletions
@@ -0,0 +1,11 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"auxiliaryInput": [1, 2, 3]
}
@@ -0,0 +1 @@
0
@@ -0,0 +1,2 @@
{"errors":[{"component":"general","formattedMessage":"\"auxiliaryInput\" must be an object","message":"\"auxiliaryInput\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,20 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ],
"": [ "legacyAST" ]
}
}
},
"auxiliaryInput":
{
"smtlib2responses": "not an object"
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"auxiliaryInput.smtlib2responses\" must be an object.","message":"\"auxiliaryInput.smtlib2responses\" must be an object.","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,23 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ],
"": [ "legacyAST" ]
}
}
},
"auxiliaryInput":
{
"smtlib2responses":
{
"abc": ["not a string"]
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"smtlib2Responses.abc\" must be a string.","message":"\"smtlib2Responses.abc\" must be a string.","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,19 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "byzantium",
"metadata": ["meta1", "meta2", "meta3"]
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.metadata\" must be an object","message":"\"settings.metadata\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,18 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
{
"optimizer": 1,
"evmVersion": "byzantium",
"metadata": {
"useLiteralContent": true
}
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.optimizer\" must be an object","message":"\"settings.optimizer\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,11 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": "not an object"
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection\" must be an object","message":"\"settings.outputSelection\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,16 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": "it's a contract, but not an array!",
"": [ "legacyAST" ]
}
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA.A\" must be a string array","message":"\"settings.outputSelection.fileA.A\" must be a string array","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": "awesome file!"
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA\" must be an object","message":"\"settings.outputSelection.fileA\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,16 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": [ 1, 2, 3 ,4],
"": [ "legacyAST" ]
}
}
}
}
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.outputSelection.fileA.A\" must be a string array","message":"\"settings.outputSelection.fileA.A\" must be a string array","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,17 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ],
"": [ "legacyAST" ]
}
},
"remappings": "not an object"
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.remappings\" must be an array of strings.","message":"\"settings.remappings\" must be an array of strings.","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,17 @@
{
"language": "Solidity",
"sources": {
"fileA": {
"content": "contract A { }"
}
},
"settings": {
"outputSelection": {
"fileA": {
"A": [ "abi", "devdoc", "userdoc", "evm.bytecode", "evm.assembly", "evm.gasEstimates", "evm.legacyAssembly", "metadata" ],
"": [ "legacyAST" ]
}
},
"remappings": [1, 2 ,3 ,4]
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings.remappings\" must be an array of strings","message":"\"settings.remappings\" must be an array of strings","severity":"error","type":"JSONError"}]}
@@ -0,0 +1 @@
["abc"]
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"Input is not a JSON object.","message":"Input is not a JSON object.","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,23 @@
{
"language": "Solidity",
"sources":
{
"A":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
},
"settings":
[
{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "byzantium",
"metadata": {
"useLiteralContent": true
}
}
]
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"settings\" must be an object","message":"\"settings\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,12 @@
{
"language": "Solidity",
"sources":
{
"A": "not an object :o",
"B": [1, 2, 3],
"C":
{
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
}
}
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"sources.A\" must be an object","message":"\"sources.A\" must be an object","severity":"error","type":"JSONError"}]}
@@ -0,0 +1,4 @@
{
"language": "Solidity",
"sources": ["source1", "source2", "source3"]
}
@@ -0,0 +1 @@
0
@@ -0,0 +1 @@
{"errors":[{"component":"general","formattedMessage":"\"sources\" is not a JSON object.","message":"\"sources\" is not a JSON object.","severity":"error","type":"JSONError"}]}