Skip to content

Print message before trapping, on DFINITY mode#279

Merged
nomeata merged 3 commits intomasterfrom
joachim/noisy-traps
Apr 4, 2019
Merged

Print message before trapping, on DFINITY mode#279
nomeata merged 3 commits intomasterfrom
joachim/noisy-traps

Conversation

@nomeata
Copy link
Contributor

@nomeata nomeata commented Mar 28, 2019

previously, in a large number of possible error conditions, whether they
are benign (array index out of bounds) or internal (type error,
unimplemented code) we just called Unreachable, causing a trap. But
this is really not helpful to our early adopters.

So in DFINITY mode, before calling Unreachable, print a helpful
error message via test.print.

I made the strings all static, so that multiple calls with the same
error message do not have to allocate static spaces multiple times. (It
currently still does, but making sure every static string is only added
to memory once is easy to do, and independent of this change.)

Some cleanup of compile_lit along the way. Also I prefer let open Foo in over Foo.(…) when is a multi-line expression with control flow
and it is the last expression of the current function anyways.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants