home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / News / Alexandra.0.82 / Source / AMGErrorHandling.subproj / EMErrorManager.h < prev    next >
Encoding:
Text File  |  1996-01-30  |  2.0 KB  |  74 lines

  1.  
  2. #import <objc/error.h>
  3. #import "EMErrorInfo.h"
  4. #import "EMErrorDescription.h"
  5. #import "dispatcher.h"
  6.  
  7.  
  8. #define ERROR_MANAGER    [EMErrorManager new]
  9.  
  10. #define EM_ERROR_RANGE    1000000
  11. #define EM_KITBASE        (0)
  12. #define EM_INTBASE        (NX_APP_ERROR_BASE)
  13. #define EM_SIGBASE        (NX_APP_ERROR_BASE+50)
  14. #define EM_APPBASE        (NX_APP_ERROR_BASE+100)
  15.  
  16. #define EM_ERROR(NUM,UD1,UD2)    [ERROR_MANAGER raise:\
  17.             [EMErrorInfo newWithCode:NUM userInfo:(UD1):(UD2)\
  18.                          file:__FILE__ line: __LINE__ ]]
  19. #define EM_ERRORF(NUM,UD1,UD2,UDFDESC)    [ERROR_MANAGER raise:\
  20.             [[EMErrorInfo newWithCode:NUM userInfo:(UD1):(UD2)\
  21.                     file:__FILE__ line: __LINE__ ] setUDFreeSemantics:(UDFDESC)]]
  22. #define EM_CONDERROR(P,NUM,UD1,UD2) do { if(P) EM_ERROR(NUM,UD1,UD2); } while(0)
  23. #define EM_CONDERRORF(P,NUM,UD1,UD2,UDFDESC) \
  24.         do { if(P) EM_ERRORF(NUM,UD1,UD2,UDFDESC); } while(0)
  25.  
  26. #define EM_DURING     NX_DURING
  27. #define EM_HANDLER    NX_HANDLER do { \
  28.             EMErrorInfo *EMLocalException=EMInfoObjectForHandler(&NXLocalHandler);
  29. #define EM_ENDHANDLER [ERROR_MANAGER handle:EMLocalException]; } while(0); \
  30.             NX_ENDHANDLER
  31. #define EM_EMPTYHANDLER EM_HANDLER EM_ENDHANDLER
  32.  
  33. #define    EM_MAJOR_VERSION    1
  34. #define EM_MINOR_VERSION    1
  35. #define EM_EMC_VERSION        5
  36.  
  37. EMErrorInfo *EMInfoObjectForHandler(NXHandler *errorState);
  38.  
  39. @class HashTable, NXBundle;
  40.  
  41. @interface EMErrorManager:Object
  42.     {
  43.     HashTable    *errorDescriptions;
  44.     HashTable    *objectsToNotify;
  45.     }
  46.     
  47.  
  48. + new;
  49.  
  50. - init;
  51. - free;
  52.  
  53. - readErrorDescriptions;
  54. - readErrorDescriptionsFromBundle:(NXBundle *)bundle;
  55. - (HashTable *)errorDescriptions;
  56. - (EMErrorDescription *)errorDescriptionFor:(int)code;
  57.  
  58. - installErrorReporter:(BOOL)flag;
  59. - installErrorHandler:(BOOL)flag;
  60. - installSignalHandler:(BOOL)flag;
  61.  
  62. - raise:infoObject;
  63. - handle:infoObject;
  64. - notify:obj of:infoObject;
  65.  
  66. - addObserver:anObject selector:(SEL)aSel forError:(int)errorNumber;
  67. - addObserver:anObject selector:(SEL)aSel forErrors:(int)base:(int)count;
  68. - removeObserver:anObject forError:(int)errorNumber;
  69. - removeObserver:anObject forErrors:(int)base:(int)count;
  70.  
  71.  
  72. @end
  73.  
  74.