next up previous contents
Next: Macros for Transaction Up: Handling Errors in a Previous: Introduction

 

The shrc Class

Most methods in Shore return an error indicator of type shrc. The shrc type contains not only an integer error code, but also a stack trace showing where the error occurred and the series of function calls that triggered the error.

Shrc is a C++ class, and it contains various member functions that application programmers may find useful. The following is a portion of the class definition of shrc (shrc is the same type as w_rc_t, which is defined in w_rc.h):

    class shrc
    {
     public:

        bool is_error() const;
        int  err_num() const;
		operator const void*() const;

        friend ostream &operator<<(ostream& o, const shrc &rc);
    };

If a Shore method completes successfully, it returns the constant RCOK. If a Shore method returns something other than RCOK, then an application can use then shrc::err_num method to get the integer error code corresponding to the error. The possible error codes are listed in the manual page errors(OC). Each error code has a #defineed value, which is included in your sources if you include ShoreApp.h.

Shrc includes operator const void*() to allow applications to say things like shrc rc = ...; if(rc).... Shrc also includes an overloading of the C++ << operator.



Marvin Solomon
Fri Aug 2 13:39:50 CDT 1996