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 @[email protected] 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
    3
    ·
    edit-2
    7 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

    • BluePowerOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 months ago

      Okay, I now understand there’s now a clear documented window.ignorePerchanceErrors and clearPerchanceErrors() function in the advanced generator, the last time I took a look at the page, it wasn’t there (here’s a snapshot of the page from 2022). Overall, the alternative method only hides the error box out of the generator and does not clear the errors, whilst it does with clearPerchanceErrors() so you cannot see them when you programatically open the error dialog (as in the example).