Error Handling and Exceptions
← All categories
- Q134: How do I use try/catch to handle exceptions in EK9?
- Q135: How does try/catch/finally work in EK9?
- Q136: How do I throw exceptions in EK9?
- Q137: How do I manage resources with try-with-resources in EK9?
- Q138: How do I catch specific exception types in EK9?
- Q139: When should I use try/catch vs Result for error handling?
- Q304: What is the require statement and when should I use it?
- Q305: What is the difference between require, assert, and throw?
- Q306: How do I test that code throws an exception in EK9?
- Q307: How do I verify that code does not throw an exception in EK9?
- Q308: How do I handle different exception types in EK9 without casting?
- Q802: Why does EK9 reject manual close of local resources?
- Q803: What happens when a closeable resource is never closed?
- Q1009: In Go I return (value, error) and check if err != nil. What does EK9 use instead?
- Q1014: In Python I use try/except for error handling. How does EK9's try/catch compare?
- Q1431: How does an EK9 program set its exit status?
- Q1432: How do I end my program with a chosen exit code when something fails?
- Q1433: What exit code does an uncaught Exception with no exit code give, and what about one that wraps a cause?
- Q1434: What is a Panic in EK9 and when does the language raise one?
- Q1435: What exit code does a failed require or assert give?
- Q1436: Should I catch an Exception that carries an exit code, or let it end the program?
- Q1437: My ek9 command exited 3 - was that the compiler or my program?
- Q1520: When does EK9 close a closeable value, and where may I keep one?
- Q1600: Who closes a closeable value, and can I close one myself?
- Q1620: Can a method return a closeable it already holds, or must it return a new one?
- Q1640: Can I keep a closeable in a variable of a trait or Any type?
- Q1660: Can I call close() on a resource like a method?
- Q1700: How do I shut a server down from a handler when only its owner may close it?
- Q1720: Why can't a closeable have an open() method that returns this - how do I acquire a resource?
- Q1740: How do I let other code use a resource my object owns without letting it close or keep it?
- Q1780: Can I put a closeable resource in a List, an Optional or my own generic type?
- Q1840: Can I give my object a resource I have already opened?
- Q1841: How do I reconnect or replace a resource my object holds?
- Q1842: In what order are the resources my object holds closed?
- Q1843: Can a type that holds a closeable resource use 'default operator :=:'?
- Q1860: Which of my types must declare their own operator close, and what may that close do?
- Q1880: How do I release the resources my class holds - and what does 'default operator close' close for me?
- Q1900: How can my code use a closeable resource it does not own?
- Q1901: How do I broadcast a message to every open connection, like a chat server, when I cannot keep a list of connections?
- Q1902: What happens when a close throws an exception - are the other resources still closed?
- Q1920: How do I see the close failures that were suppressed onto the exception I caught?
- Q1940: When exactly is a closeable I never name closed - what if it is made inside an 'and', a ternary or a coalescing operator?