VisualIB  1.0
IBExpress library for making use of Borland IBExpress outside of C++Builder
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
VIBInternalErrors.h
Go to the documentation of this file.
1 
8 #ifndef VIBINTERNALERRORS_H__
9 #define VIBINTERNALERRORS_H__
10 
11 #include "../viberror.h"
12 #include "classVIBError.h"
13 
14 static inline void TestForVIBError(bool result)
15 {
16  if(!result)
17  {
18  const char *msg;
19  int IBErrorCode;
20  int SQLCode;
21 
22  VIBError_GetLastError(&msg, &IBErrorCode, &SQLCode);
23 
24  if(IBErrorCode == 0 && SQLCode == 0) // internal error
25  throw VIB::Error(msg);
26  else
27  throw VIB::IBError(msg, IBErrorCode, SQLCode);
28  }
29 }
30 
31 #define VIBSAFECALL(func) TestForVIBError(!!(func))
32 
33 #endif
34 
35 // EOF
36