I’ve just found another pretty cool way to get rid of the error box in a generator without using the __clearPerchanceErrors() function that you can run on the testing panel to get a similar effect (as mentioned by @perchance@lemmy.world that it’s probably a “private function” as well along with other alike properties in the Perchance engine), and so I made another quick example on how you can do that.

The difference is that the error box only gets “hidden” while you can still review the errors by running [__showPerchanceErrorBox(), ""] in the testing panel, whilst all the errors get removed completely with the __clearPerchanceErrors() method.

I’ve also showcased how you can show the error box even when there aren’t any errors in the generator whatsoever.

  • VioneT@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    5 months ago

    If you want to run some code but ignore any Perchance errors that occur during it, then use this: window.ignorePerchanceErrors(() => { putYourCodeHere }). The return value of this function is the return value of the callback code that you provide. Useful when evaluating user-provided Perchance syntax which may have bugs. You can also run window.clearPerchanceErrors() to clear all existing error logs.

    From the Advance Perchance Tutorial