Closed fubuloubu closed 1 month ago
errorType can be SyntaxError Exception, which I think was a type of error I saw when testing.
errorType can be SyntaxError Exception, which I think was a type of error I saw when testing.
right, but from your perspective it's just a string
that gets printed right?
Also the errors that are returned are very random and sometime has nothing to do with the code being compiled.
Also the errors that are returned are very random and sometime has nothing to do with the code being compiled.
We are aware of that as a separate issue, if you use the proper PEP440 version specifier it should compile fine (or at least raise a proper compiler bug)
With the latest updated of Hosted Compiler #53
the exceptions/{task_id}
now has a response like this:
[
{
"status": "failed",
"message": "/tmp/tmpa059soqe/unknown-project-730365/contracts/fail_misspell.vy\nModuleNotFound:snekmate.tokens.ercasd20\n\n contract \"/tmp/tmpa059soqe/unknown-project-730365/contracts/fail_misspell.vy:41\", line 41:0 \n 40 # @dev We import and initialise the `erc20` module.\n ---> 41 from snekmate.tokens import ercasd20\n --------^\n 42 initializes: erc20[ownable := ow]\n",
"column": 0,
"line": 41,
"error_type": "VyperCompileError"
}
]
message, line and column are different fields.
i would also note, it useful for remix to see the /tmp/tmpa059soqe/unknown-project-730365/contracts/fail_misspell.vy
before the \n
so you know what contract it fails on. But it would not be useful for the user.
you could pattern match to find the start of /tmp
and end the match with \n
like this
# Remove the /tmp/... part along with any trailing newline after it
filtered_message = re.sub(r'/tmp[^:]*:\d+\n?', '', error_message)
i would also note, it useful for remix to see the
/tmp/tmpa059soqe/unknown-project-730365/contracts/fail_misspell.vy
before the\n
so you know what contract it fails on. But it would not be useful for the user.you could pattern match to find the start of
/tmp
and end the match with\n
like this# Remove the /tmp/... part along with any trailing newline after it filtered_message = re.sub(r'/tmp[^:]*:\d+\n?', '', error_message)
This temporary file is due to how we are internally compiling it, I would suggest that we create a separate issue to find temporary directory (e.g. /tmp/.../unknown-project-.../contracts/
) and remove it from any error text so that the user doesn't get confused
Describe
Downstream integrators want better support for displaying errors from this service, create a more structured way for displaying compiler errors so that they can be displayed
Specification
Remix's error structure is as follows:
Not all errors would it make sense to change, but the result obtained from the
/errors/{task_id}
endpoint should be described this way, for any configuration or compile-time exceptionsDependencies
n/a