]> cygwin.com Git - cygwin-apps/setup.git/blobdiff - Exception.h
Use solver to check for problems and produce a list of package transactions
[cygwin-apps/setup.git] / Exception.h
index b36a81bcdba73517f12484017dedbdc7ed065c4c..e4abd18b86de61470fcccc32e03c56493bdaffbe 100644 (file)
 #ifndef SETUP_EXCEPTION_H
 #define SETUP_EXCEPTION_H
 
-/* this is the parent class for all package source (not source code - installation
- * source as in http/ftp/disk file) operations.
- */
-
 #include <exception>
-#include "String++.h"
+#include <string>
+#include <typeinfo>
+#include "msg.h"
 
-/* Generic excpetion class for throwing exceptions */
 class Exception : public std::exception {
 public:
   Exception (char const *where, char const *message, int appErrNo = 0);
-  Exception (char const *where, const String &message, int appErrNo = 0);
-  ~Exception () throw () {}
+  Exception (char const *where, const std::string& message, int appErrNo = 0);
+  ~Exception () throw() {};
   char const *what() const throw();
   int errNo() const;
 private:
-  String _message;
+  std::string _message;
   int appErrNo;
 };
 
-// Where should these live?
 #define APPERR_CORRUPT_PACKAGE 1
 #define APPERR_IO_ERROR                2
 #define APPERR_LOGIC_ERROR     3
+#define APPERR_WINDOW_ERROR    4
+
+#define TOPLEVEL_CATCH(owner, threadname)                             \
+  catch (Exception *e)                                                  \
+  {                                                                     \
+    fatal((owner), IDS_UNCAUGHT_EXCEPTION_WITH_ERRNO, (threadname),   \
+        typeid(*e).name(), e->what(), e->errNo());                      \
+  }                                                                     \
+  catch (std::exception *e)                                             \
+  {                                                                     \
+    fatal((owner), IDS_UNCAUGHT_EXCEPTION, (threadname),              \
+        typeid(*e).name(), e->what());                                  \
+  }
+
 
 #endif /* SETUP_EXCEPTION_H */
This page took 0.024212 seconds and 5 git commands to generate.