Seperate Dali::Exception / std::exception and otherwise 07/316307/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 12 Dec 2024 12:13:31 +0000 (21:13 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 12 Dec 2024 12:13:31 +0000 (21:13 +0900)
Until now, SWIG_UnknownError, SWIG_RuntimeError, SWIG_SystemError
are all catched as SWIG_CSharpApplicationException.

It make hard to debuging error case by exception.

To make more detail, let we seperate the callback of exception
as System / InvaildOperation / and Application.

Change-Id: I5532e1c03de525a4a3e449f6d65224bf544fff64
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-csharp-binder/common/common.h
dali-csharp-binder/common/dali-wrap.cpp

index 2051d47cb181c70104def0236dd9a3bc24f1e63c..7ff1b8886dd82f96b7571f79c894a4d4aec5b600 100755 (executable)
@@ -2,7 +2,7 @@
 #define CSHARP_COMMON_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -105,6 +105,7 @@ constexpr static int SWIG_SystemError        = -10;
 constexpr static int SWIG_AttributeError     = -11;
 constexpr static int SWIG_MemoryError        = -12;
 constexpr static int SWIG_NullReferenceError = -13;
+constexpr static int SWIG_DaliError          = -14;
 
 /* Support for throwing C# exceptions from C/C++. There are two types:
  * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
@@ -184,7 +185,7 @@ SWIG_ExceptionMessageWithFileAndLine((code), (what), __FILE__, __LINE__, __FUNCT
   }                                                                                     \
   catch (Dali::DaliException e)                                                         \
   {                                                                                     \
-    SWIG_EXCEPTION_WITH_FILE_AND_LINE(SWIG_SystemError, e.condition);                   \
+    SWIG_EXCEPTION_WITH_FILE_AND_LINE(SWIG_DaliError, e.condition);                     \
     return ret;                                                                         \
   }                                                                                     \
   catch (abi::__forced_unwind &)                                                        \
@@ -212,7 +213,7 @@ SWIG_ExceptionMessageWithFileAndLine((code), (what), __FILE__, __LINE__, __FUNCT
   }                                                                                                                              \
   catch (Dali::DaliException e)                                                                                                  \
   {                                                                                                                              \
-    SWIG_ExceptionMessageWithFileAndLine(SWIG_SystemError, e.condition, (filename), (linenumber), (funcname));                   \
+    SWIG_ExceptionMessageWithFileAndLine(SWIG_DaliError, e.condition, (filename), (linenumber), (funcname));                     \
     return ret;                                                                                                                  \
   }                                                                                                                              \
   catch (abi::__forced_unwind &)                                                                                                 \
@@ -242,7 +243,7 @@ SWIG_ExceptionMessageWithFileAndLine((code), (what), __FILE__, __LINE__, __FUNCT
   }                                                                                     \
   catch (Dali::DaliException e)                                                         \
   {                                                                                     \
-    SWIG_EXCEPTION_WITH_FILE_AND_LINE(SWIG_SystemError, e.condition);                   \
+    SWIG_EXCEPTION_WITH_FILE_AND_LINE(SWIG_DaliError, e.condition);                     \
     (*(func))(__VA_ARGS__);                                                             \
     return ret;                                                                         \
   }                                                                                     \
index 8dd749e18d036ccf2dcc15d03eb4da91e5f8f268..88ac76590f6d26580736d305c52fe9265cbbf68d 100644 (file)
@@ -371,13 +371,18 @@ void SWIG_CSharpException(int code, const char *msg) {
     case SWIG_OverflowError:
       exception_code = SWIG_CSharpOverflowException;
       break;
+    case SWIG_DaliError: ///< Dali::Exception
+      exception_code = SWIG_CSharpApplicationException;
+      break;
     case SWIG_RuntimeError:
+      exception_code = SWIG_CSharpInvalidOperationException;
+      break;
     case SWIG_TypeError:
     case SWIG_SyntaxError:
     case SWIG_SystemError:
     case SWIG_UnknownError:
     default:
-      exception_code = SWIG_CSharpApplicationException;
+      exception_code = SWIG_CSharpSystemException;
       break;
     }
     SWIG_CSharpSetPendingException(exception_code, msg);