|
| 1 | +## Error handling: Categories of errors |
| 2 | + |
| 3 | +_Skeleton descriptions are typeset in italic text,_ |
| 4 | +_so please don't remove these descriptions when editing the topic._ |
| 5 | + |
| 6 | +### Overview |
| 7 | + |
| 8 | +_Provides a short natural language abstract of the module’s contents._ |
| 9 | +_Specifies the different levels of teaching._ |
| 10 | + |
| 11 | +------------------------------------------------------------------------ |
| 12 | +Level Objective |
| 13 | +----------------- ------------------------------------------------------ |
| 14 | +Foundational Categories of errors |
| 15 | + |
| 16 | +Main Handling different categories of errors |
| 17 | + |
| 18 | +Advanced --- |
| 19 | + |
| 20 | +------------------------------------------------------------------------ |
| 21 | + |
| 22 | +### Motivation |
| 23 | + |
| 24 | +_Why is this important?_ |
| 25 | +_Why do we want to learn/teach this topic?_ |
| 26 | + |
| 27 | +Programs can run in a normal state or erroneous state. Students should be able |
| 28 | +to identify different types of erroneous state and how to best handle them. |
| 29 | + |
| 30 | +### Topic introduction |
| 31 | + |
| 32 | +_Very brief introduction to the topic._ |
| 33 | + |
| 34 | +This topic is an umbrella topic that refers to the different topics for types of errors and error handling. |
| 35 | + |
| 36 | +### Foundational: Categories of errors {#coe-found} |
| 37 | + |
| 38 | +#### Background/Required Knowledge |
| 39 | + |
| 40 | +A student: |
| 41 | + |
| 42 | +* should know the basics about linkage [[C++ compilation model: Linkage - Foundational]][1] |
| 43 | + |
| 44 | +#### Student outcomes |
| 45 | + |
| 46 | +_A list of things "a student should be able to" after the curriculum._ |
| 47 | +_The next word should be an action word and testable in an exam._ |
| 48 | +_Max 5 items._ |
| 49 | + |
| 50 | +A student should be able to: |
| 51 | + |
| 52 | +1. Describe different kinds of errors and exceptional situations that require different approaches of error handling. |
| 53 | +2. Provide some examples of the different error categories. |
| 54 | +3. Identify potential erroneous code sections and attribute them to different error categories. |
| 55 | + |
| 56 | + |
| 57 | +#### Caveats |
| 58 | + |
| 59 | +_This section mentions subtle points to understand, like anything resulting in |
| 60 | +implementation-defined, unspecified, or undefined behavior._ |
| 61 | + |
| 62 | +No caveats at present. |
| 63 | + |
| 64 | +#### Points to cover |
| 65 | + |
| 66 | +_This section lists important details for each point._ |
| 67 | + |
| 68 | +Errors can happen at different times during software lifetime. |
| 69 | + |
| 70 | +* Compile-time errors |
| 71 | +* Link-time errors |
| 72 | +* Execution-time errors |
| 73 | + |
| 74 | +There are different types of errors |
| 75 | + |
| 76 | +* Logic errors (violations of logical preconditions) |
| 77 | +* Run-time errors (errors during code execution due to causes that are external to the program) |
| 78 | + |
| 79 | + |
| 80 | +### Main: Handling different categories of errors {#coe-main} |
| 81 | + |
| 82 | +#### Background/Required Knowledge |
| 83 | + |
| 84 | +#### Student outcomes |
| 85 | + |
| 86 | +A student should be able to: |
| 87 | + |
| 88 | +1. pick the right error handling approach for a given problem. |
| 89 | +2. enumerate different error handling strategies. |
| 90 | +3. make a clear distinction between error-handling code and normal-case handling code |
| 91 | + |
| 92 | + |
| 93 | +#### Caveats |
| 94 | + |
| 95 | +* The different error handling strategies have different trade-offs (runtime performance, readability, ...) |
| 96 | +* The trade-off space depends on the run-time context (embedded, ...) |
| 97 | +* There also exist unhandleable errors (e.g., ODR violations, undefined behavior) |
| 98 | + |
| 99 | +#### Points to cover |
| 100 | + |
| 101 | +* Exception handling [[Error handling: Exception handling - Foundational]][2] |
| 102 | +* Returning a value indication failure [[Error handling: C-style error-codes - Foundational]][3] |
| 103 | +* Terminating the program |
| 104 | +* Improving error handling by having the error occur at an earlier stage in the software development cycle [[Error handling: Static assert - Foundational]][4] |
| 105 | + |
| 106 | +### Advanced {#coe-advanced} |
| 107 | + |
| 108 | +_These are important topics that are not expected to be covered but provide |
| 109 | +guidance where one can continue to investigate this topic in more depth._ |
| 110 | + |
| 111 | +[1]: ../compilation-model/linkage.md |
| 112 | +[2]: ../error-handling/exception-handling.md |
| 113 | +[3]: ../error-handling/c-style-error-codes.md |
| 114 | +[4]: ../error-handling/static-assert.md |
0 commit comments