Skip to content

Commit

Permalink
Update Handling-Exceptional-Events.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd authored Feb 27, 2024
1 parent 38caf5e commit 8dc20f4
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ If your method ends up in a situation where it could not return any meaningful o

### Log errors as exceptions

You can also opt to catch BHoM Error Events as Exceptions if you so wish. By default, errors are just logged in the Log and not handled any further. However, you can call `BH.Engine.Base.Compute.ThrowError(false)` which will turn off the suppression of exception throwing.
You can also opt to catch BHoM Error Events as Exceptions if you so wish. By default, errors are just logged in the Log and not handled any further. However, you can call `BH.Engine.Base.Compute.ThrowErrorsAsExceptions(true)` which will turn off the suppression of exception throwing.

If you choose to do this, any error recorded into the Log while this suppression is off will be thrown as an exception itself, which you can then catch in a `try/catch` statement.

If you want to turn the suppression back on after your use, you can call `BH.Engine.Base.Compute.ThrowError(true)` and this will revert the Log to work in the default manner.
If you want to turn the suppression back on after your use, you can call `BH.Engine.Base.Compute.ThrowErrorsAsExceptions(false)` and this will revert the Log to work in the default manner.

## Good Log Messages

Expand Down Expand Up @@ -296,4 +296,4 @@ If you want to retrieve events raised during the suppressed time period, you can

The suppressed log will be reset once its events have been retrieved, so you don't need to worry about retrieving duplicates.

Retrieved events won't appear on the UI on components though, so users may still not know about them initially, but they can be queried using the same access components above in any of the BHoM supported UIs.
Retrieved events won't appear on the UI on components though, so users may still not know about them initially, but they can be queried using the same access components above in any of the BHoM supported UIs.

0 comments on commit 8dc20f4

Please sign in to comment.