Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!mips!pacbell.com!pacbell!hoptoad!farcomp!murat From: murat@farcomp.UUCP (Murat Konar) Newsgroups: comp.sys.mac.programmer Subject: Re: Why won't ResError return the right message? Message-ID: <363@farcomp.UUCP> Date: 7 May 91 04:52:21 GMT References: <1696@babcock.cerc.wvu.wvnet.edu> Reply-To: murat@farcomp.UUCP (Murat Konar) Organization: Farallon Computing Inc. Berkeley, CA Lines: 26 In article <1696@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes: [preamble and code frag ommitted] >As you can see, the soundness of the code relies on ResError to >tell if anything has gone wrong. However, I tried testing the >code by removing the crucial resource and running this code again. >Even though GetResource couldn'thave found the resource (because >it wasn't there), ResError returned a 0, indicating that nothing >was wrong. Needless to say, the first time I referred to the >resource, I got a Bus Error exception, because I was following >the invalid handle out into La-La Land. > >Why didn't ResError tell me there was a problem? Page 119, Inside Macintosh Volume I sez (and I quote): Note: If you call GetResource with a resource type that isn't in any open resource file, it returns NIL but the ResError function will return the result code noErr. Neat, huh? I got bit by this before too. -- ____________________________________________________________________ Have a day. :^| Murat N. Konar murat@farcomp.UUCP -or- farcomp!murat@apple.com