Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" Newsgroups: comp.lang.c Subject: Re: encapsulating directory operations Date: Sun, 8 Jun 2025 11:48:45 -0700 Organization: A noiseless patient Spider Lines: 34 Message-ID: <1024lue$3nh$1@dont-email.me> References: <100h650$23r5l$1@dont-email.me> <0e9619f7d873a4ec436f017bac1192c73c5283e5.camel@gmail.com> <1020eu8$2pifl$1@raubtier-asyl.eternal-september.org> <1e3f53801e22a94356b9b0aded0ed7d33e67fd06.camel@gmail.com> <1021pgp$35sqk$1@raubtier-asyl.eternal-september.org> <1858c98adc50b2bec4021f15d0c5b94e2158f6b5.camel@gmail.com> <10223hq$38g0s$1@raubtier-asyl.eternal-september.org> <10229vo$3b858$1@dont-email.me> <102497b$3tavs$3@raubtier-asyl.eternal-september.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 08 Jun 2025 20:48:47 +0200 (CEST) Injection-Info: dont-email.me; posting-host="70cb91fe2d757a1307804306c54176bf"; logging-data="3825"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RzDnsRDMEvUQ2UzLpNXRjP4C1vR8dAoQ=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:O5HhY/b1yfZIWLO6A7lZmV2PKYw= Content-Language: en-US In-Reply-To: On 6/8/2025 9:58 AM, Scott Lurndal wrote: > Bonita Montero writes: >> Am 07.06.2025 um 23:12 schrieb Janis Papanagnou: >> >>> Context, in the general case, matters. ... >> >> If you need the context then you catch the exception near where >> it is thrown; but that's not usual, meaning in most cases you >> don't need that context. F.e. when a bad_alloc is thown it dosn't >> matter which allocation failed, it's just enough to know that a >> memory-collapse happened. > > Actually it very much matters where the allocation failed, if > one wishes to recover from it. Exactly. If an allocation failed in some of my older server code, 20 years ago for sure. Well, it would make the server go into a sort of "panic mode" and dump cache, dump timed out connections, ect, then it would try the allocation again. If that failed, it would go into shit hit the fan mode... ;^) Another fun aspect is in panic mode, instead of dumping timedout connections that are deemed worthy, I send them a special packet. It says, disconnect from me and connect to my friend server, here is the address and port. > It seems your concept of error > handling is simply reporting it (hopefully with sufficient > context information for the user to understand what needs to > be fixed) and calling exit().