Skip to content

Commit 4ee53f2

Browse files
committed
Use JSONError type instead of SOLCError to make the wrapper error messages similar to libsolc
1 parent 9f61d2c commit 4ee53f2

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

test/compiler.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -563,21 +563,19 @@ function runTests (solc, versionText) {
563563
t.test('compiling standard JSON (invalid JSON)', function (st) {
564564
var output = JSON.parse(solc.compile('{invalid'));
565565
// TODO: change wrapper to output matching error
566-
st.ok(expectError(output, 'JSONError', 'Line 1, Column 2\n Missing \'}\' or object member name') || expectError(output, 'SOLCError', 'Invalid JSON supplied:'));
566+
st.ok(expectError(output, 'JSONError', 'Line 1, Column 2\n Missing \'}\' or object member name') || expectError(output, 'JSONError', 'Invalid JSON supplied:'));
567567
st.end();
568568
});
569569

570570
t.test('compiling standard JSON (invalid language)', function (st) {
571571
var output = JSON.parse(solc.compile('{"language":"InvalidSolidity","sources":{"cont.sol":{"content":""}}}'));
572-
// TODO: change wrapper to output matching error
573-
st.ok(expectError(output, 'JSONError', 'supported as a language.') || expectError(output, 'SOLCError', 'Only "Solidity" is supported as a language.'));
572+
st.ok(expectError(output, 'JSONError', 'supported as a language.') && expectError(output, 'JSONError', '"Solidity"'));
574573
st.end();
575574
});
576575

577576
t.test('compiling standard JSON (no sources)', function (st) {
578577
var output = JSON.parse(solc.compile('{"language":"Solidity"}'));
579-
// TODO: change wrapper to output matching error
580-
st.ok(expectError(output, 'JSONError', 'No input sources specified.') || expectError(output, 'SOLCError', 'No input sources specified.'));
578+
st.ok(expectError(output, 'JSONError', 'No input sources specified.'));
581579
st.end();
582580
});
583581

@@ -586,7 +584,7 @@ function runTests (solc, versionText) {
586584
if (solc.features.multipleInputs) {
587585
st.ok(expectNoError(output));
588586
} else {
589-
st.ok(expectError(output, 'SOLCError', 'Multiple sources provided, but compiler only supports single input.') || expectError(output, 'Parser error', 'Parser error: Source not found.'));
587+
st.ok(expectError(output, 'JSONError', 'Multiple sources provided, but compiler only supports single input.') || expectError(output, 'Parser error', 'Parser error: Source not found.'));
590588
}
591589
st.end();
592590
});

wrapper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function setupMethods (soljson) {
122122
return JSON.stringify({
123123
errors: [
124124
{
125-
'type': 'SOLCError',
125+
'type': 'JSONError',
126126
'component': 'solcjs',
127127
'severity': 'error',
128128
'message': message,

0 commit comments

Comments
 (0)