Nepedia
Back to Discover
Independent Reader
💻

Exception handling

technology Maturity 11-13 war conflict Next article →

This article covers sensitive topics: war_conflict. Parents can manage visibility in Parental Controls.

Computers follow rules to finish a task. Sometimes, something unusual happens. This is called an exception. An exception is a condition that needs special care. It breaks the normal way a program works.

When an exception happens, the computer stops its usual path. It looks for a pre-registered exception handler. This is a special set of steps to deal with the problem. Different parts of a computer handle these in different ways. The CPU can use interrupts. The operating system can use signals. Programming languages also have their own way to handle them.

An exception can happen for many reasons. A file might be missing. The computer might run out of memory. A person might try to divide a number by zero. The person who writes the code decides what counts as an exception. They can make the computer stop. They can also make it use a special value instead. For example, some systems use infinity if you divide by zero. Some fixes are so good that the computer can just keep working. It can resume its job right where it left off.

184 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.