Returning an error from an absolute
09/11/2018 10:19
There should be some information on this, but I cannot find it. Not in the PRM, not in google. Must be looking in the wrong places...

Anyway, my SpamStamp program is an absolute that does some thingies. Of course, a lot of things can go wrong, so sometimes it needs to abort with an error.

The question is simple really. How do I do that? The PRM seems to say 'return with OS_GenerateError' but if I do that, the error isn't shown to the user, which is kind of not so handy. So my code to exit, when I detect an error has occured is: printf(%s , error->errmess); xos_generate_error (error); (where 'error' is a pointer to an errorblock) If I replace the xos_generate_error to os_generate_error I get a postmortem (but the error gets reported).

When this code failed due to a bug the last few days I and at least a few others experienced that the 'printf' way of reporting the error did not work in a taskwindow. While the error was 'Bad time values' the errors in the taskwindow were: Bessage Token D Bnknown OS_Scre Bllegal window (RISC OS 5, if that matters) The length seems correct, the first character seems correct. The rest has nothing to do, or so it seems, with the actual situation.

Singletasking it seems to report the errors correctly.

Now, I cannot seem to recreate this situation with a small test program.

Any suggestions how to do this correctly?...

Cheers, Jan-Jaap

Source is Usenet: comp.sys.acorn.programmer
Sign in to add a comment

Answer score: 5
09/11/2018 10:19 - Martin Dann <Martin@f451.freeserve.co.uk> wrote: Yes, that was what I expected as well...

Hm, the index of the acorn C manual doesn't know the words 'postmortem' or 'error handler'. :-( Well, the error is a normal error returned previously from the OS (or sometimes generated by my program). So it shouldn't be corrupted unless it gets corrupted on the way.

What should I do with returned errors? Should I copy the information, or can I rely on them remaining there? I'll re-introduce the original bug, to see what happens :-) Cheers, Jan-Jaap

Source is Usenet: comp.sys.acorn.programmer
Sign in to add a comment

Answer score: 5
09/11/2018 10:19 - In message <1d1b48cc4c.Jan-Jaap@jjvdgeer.c2i.net> Jan-Jaap van der Geer <jjvdgeer@zapo.net> wrote: I am sure that you need the non X version of this swi. e.g. (In basic) AIUI the postmortem is generated by the C error handler, so you may be able to turn off the postmortem at compile time.

It sounds like you are not passing the error string back from where the error occurs, to the error handler. Are you sure your not passing back a single character, instead of a character array. And then setting the length of the string to that of the correct error.

If I were you I would stick some printf(%s , error->errmess); lines directly after the offending erronous call, and in every function back to the error handler. So that you can see where the problem is.

Martin.

-- Typed by monkey #27662472869676 on typewriter #7552416572242 When emailing me, please include the word Banana in the subject line.


Source is Usenet: comp.sys.acorn.programmer
Sign in to add a comment

eDiscover
Helpforce eDiscover provides technical articles updated each dayHelpforce eDiscover RSS feed contains the latest technical articles in RSS
Click the logo to go back to the main page
Search eDiscover
  
Categories

Click an icon to go to that category

Helpforce eDiscover contains articles about Microsoft Windows Helpforce eDiscover contains articles about Apple products and MacOS Helpforce eDiscover contains articles about Linux and POSIX operating systems Helpforce eDiscover contains articles about Helpforce Helpforce has a large variety of technical information and articles for you to read Helpforce eDiscover contains articles about databases, MYSQL, SQL Server Oracle Helpforce eDiscover contains articles about Java, JVM and the JRE Helpforce eDiscover contains articles about the QNX operating system Helpforce eDiscover contains articles about Oracle Solaris and Open Solaris Helpforce eDiscover contains articles about RISC OS, Acorn and the BBC Micro Helpforce eDiscover contains articles about Amiga and AmigaOS

Type your comment into the box below