Home | History | Annotate | Download | only in tcl
      1 /* -----------------------------------------------------------------------------
      2  * error manipulation
      3  * ----------------------------------------------------------------------------- */
      4 
      5 SWIGINTERN const char*
      6 SWIG_Tcl_ErrorType(int code) {
      7   const char* type = 0;
      8   switch(code) {
      9   case SWIG_MemoryError:
     10     type = "MemoryError";
     11     break;
     12   case SWIG_IOError:
     13     type = "IOError";
     14     break;
     15   case SWIG_RuntimeError:
     16     type = "RuntimeError";
     17     break;
     18   case SWIG_IndexError:
     19     type = "IndexError";
     20     break;
     21   case SWIG_TypeError:
     22     type = "TypeError";
     23     break;
     24   case SWIG_DivisionByZero:
     25     type = "ZeroDivisionError";
     26     break;
     27   case SWIG_OverflowError:
     28     type = "OverflowError";
     29     break;
     30   case SWIG_SyntaxError:
     31     type = "SyntaxError";
     32     break;
     33   case SWIG_ValueError:
     34     type = "ValueError";
     35     break;
     36   case SWIG_SystemError:
     37     type = "SystemError";
     38     break;
     39   case SWIG_AttributeError:
     40     type = "AttributeError";
     41     break;
     42   default:
     43     type = "RuntimeError";
     44   }
     45   return type;
     46 }
     47 
     48 
     49 SWIGINTERN void
     50 SWIG_Tcl_SetErrorObj(Tcl_Interp *interp, const char *ctype, Tcl_Obj *obj)
     51 {
     52   Tcl_ResetResult(interp);
     53   Tcl_SetObjResult(interp, obj);
     54   Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
     55 }
     56 
     57 SWIGINTERN void
     58 SWIG_Tcl_SetErrorMsg(Tcl_Interp *interp, const char *ctype, const char *mesg)
     59 {
     60   Tcl_ResetResult(interp);
     61   Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
     62   Tcl_AppendResult(interp, ctype, " ", mesg, NULL);
     63   /*
     64   Tcl_AddErrorInfo(interp, ctype);
     65   Tcl_AddErrorInfo(interp, " ");
     66   Tcl_AddErrorInfo(interp, mesg);
     67   */
     68 }
     69 
     70 SWIGINTERNINLINE void
     71 SWIG_Tcl_AddErrorMsg(Tcl_Interp *interp, const char* mesg)
     72 {
     73   Tcl_AddErrorInfo(interp, mesg);
     74 }
     75 
     76 
     77