Explorar el Código

Ik wilde ook wel eens iets committen, dus even dit gemaakt.. nog niet erg super multi inzetbaar gezien we nergens nog echt file readen of image readen enzo maar toch

unknown hace 14 años
padre
commit
d11095b088
Se han modificado 1 ficheros con 17 adiciones y 0 borrados
  1. 17 0
      src/Error.py

+ 17 - 0
src/Error.py

@@ -0,0 +1,17 @@
+import traceback, os.path
+
+class Error:
+    def __init__(self, message=None):
+        stack = traceback.extract_stack()
+        origin_of_call      = stack[0]
+        where_it_went_wrong = stack[1]
+
+        if message:
+          print message, "\n"
+
+        print "Error in", origin_of_call[0], "on line", origin_of_call[1]
+        print " : ", origin_of_call[3], "\n"
+
+        # Inside try function, so -2 lines as exept and Error() are 2 lines
+        print "Function called in", where_it_went_wrong[0]
+        print "around line", (where_it_went_wrong[1] - 2), "\n"