contractis
Advanced tools
Comparing version 0.0.11 to 0.0.12
{ | ||
"name": "contractis", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Design by Contract for JavaScript", | ||
@@ -21,3 +21,3 @@ "repository": "github:saltcorn/saltcorn", | ||
}, | ||
"gitHead": "49c51a20665bddb9ff4e2e484de294e190f27b58" | ||
"gitHead": "88ae255c919879e321b718d9cd433781e588efd8" | ||
} |
12
util.js
@@ -20,7 +20,9 @@ const get_return_contract = (returns, args) => | ||
: theContract.contract_name; | ||
message = `value ${JSON.stringify( | ||
val, | ||
null, | ||
2 | ||
)} violates contract ${conStr}${in_str}`; | ||
var value; | ||
try { | ||
value = JSON.stringify(val, null, 2); | ||
} catch (e) { | ||
value = `Error printing value: ${e.message}`; | ||
} | ||
message = `value ${value} violates contract ${conStr}${in_str}`; | ||
if (theContract.get_error_message) { | ||
@@ -27,0 +29,0 @@ message += ". " + theContract.get_error_message(val); |
31912
1108