An ordinary error is one that can be expected to occur. For example,
opening a file may fail because the file does not exist or the process
doesn't have permission to open it. An exceptional error is one that is not
expected to occur and often indicates the state of the program is invalid.
For example, a data structure that contains pointers that should never be
nil. If a nil pointer is found that means the structure is corrupted.
Probably due to a programming bug. Exceptional errors are those which may
make it unsafe to continue execution. In which case calling panic() may be
the only sensible course of action.

On Fri, Sep 29, 2023 at 2:38 PM Kamil Ziemian <kziemian...@gmail.com> wrote:

> Hello,
>
> In Go FAQ we read "We believe that coupling exceptions to a control
> structure, as in the try-catch-finally idiom, results in convoluted code.
> It also tends to encourage programmers to label too many ordinary errors,
> such as failing to open a file, as exceptional.", " Go also has a couple of
> built-in functions to signal and recover from truly exceptional
> conditions.".
>
> Can you explain to me in general terms what is a ordinary and exceptional
> error? I'm just a hobbist programer and I never think about errors in that
> way.
>
> Best regards,
> Kamil
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/e9fdeb9d-e3b6-49ea-b7e3-5ab7ddafea7bn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/e9fdeb9d-e3b6-49ea-b7e3-5ab7ddafea7bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_6J6nEzTpqaZQzTzuDCcxhaUroP%3D%2BLySXqpGT2otOfEQ%40mail.gmail.com.

Reply via email to