For reference you might also want to have a look at this old thread: Please stop using `error` and `ErrorException` in packages (and Base). My general feeling from that thread was that there isn’t really a consensus on how exceptions should be used, though personally I don’t use them for flow control for the reason that Tamas laid out (expense).
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Style guide for throwing errors? | 6 | 1551 | November 20, 2018 | |
| Does Julia have the Python equivalent of ValueError? | 11 | 2132 | June 10, 2021 | |
| `error` vs `throw(ArgumentError(...))` | 3 | 5545 | December 22, 2018 | |
| ArgumentError does not work inside for loops and other blocks | 2 | 236 | June 16, 2023 | |
| Best way to enforce argument requirements (assert vs. exception, or something else)? | 3 | 1341 | April 23, 2021 |