ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Syncify/Error.hpp
(Generate patch)

Comparing:
Spectre2/Error.hpp (file contents), Revision 428 by douglas, 2005-03-24T17:38:00-08:00 vs.
Syncify/Error.hpp (file contents), Revision 442 by douglas, 2005-04-12T16:50:57-07:00

# Line 1 | Line 1
1 < // Spectre 2
1 > // Syncify
2   //
3   // Douglas Thrift
4   //
# Line 16 | Line 16
16   #include <menes-api/error.hpp>
17  
18   #include <errno.h>
19 + #include <libsmbclient.h>
20  
21   struct MENES_DECLARE ApiTraits : public api::ErrorTraits<int>
22   {
23          static const unsigned ErrorBase = 10;
24          static const char* GetName() { return "SMBC"; }
25          static ErrorCode GetLastError() { return errno; }
26 <        static ext::String GetMessage(const ErrorCode& code)
26 <        {
27 <                char buffer[1024];
28 <
29 < #ifdef __GNUC__
30 <                return ext::Buffer(::strerror_r(code, buffer, sizeof (buffer)));
31 < #else
32 <                api::Posix::CheckError(::strerror_r(code, buffer, sizeof (buffer)));
33 < #endif
34 <
35 <                return ext::Buffer(buffer);
36 <        }
26 >        static ext::String GetMessage(const ErrorCode& code);
27   };
28  
29   MENES_DECLARE typedef api::ErrorImpl<ApiTraits> Error;
# Line 45 | Line 35 | _finline int CheckError(int status)
35          return status;
36   }
37  
38 + _finline ::SMBCCTX* CheckError(::SMBCCTX* result)
39 + {
40 +        if (result == NULL)
41 +                throw Error();
42 +        return result;
43 + }
44 +
45   #endif//_Error_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines