shithub: pokecrystal

Download patch

ref: 95f7270141cbdb32c7d178a8a89a822e66e3a113
parent: 2c22d9220c48b2a36550b5a5a2bae1e0988da0d6
author: Bryan Bishop <[email protected]>
date: Sat Aug 31 05:51:31 EDT 2013

raise MacroException instead of Exception

A more specific exception means that error handling can actually work in
the future.

--- a/preprocessor.py
+++ b/preprocessor.py
@@ -478,7 +478,7 @@
 
         # check if there are no params (redundant)
         if len(params) == 1 and params[0] == "":
-            raise Exception("macro has no params?")
+            raise MacroException("macro has no params?")
 
     # write out a comment showing the original line
     if show_original_lines:
@@ -519,11 +519,11 @@
                 elif param_klass.size == 3:
                     allowed_length += 2 # bank and label
                 else:
-                    raise Exception(
+                    raise MacroException(
                         "dunno what to do with a macro param with a size > 3"
                     )
             else:
-                raise Exception(
+                raise MacroException(
                     "dunno what to do with this non db/dw macro param: {klass} in line {line}"
                     .format(klass=param_klass, line=original_line)
                 )
@@ -581,7 +581,7 @@
                 output += ("db " + param_klass.from_asm(param) + "\n")
                 index += 1
             else:
-                raise Exception(
+                raise MacroException(
                     "dunno what to do with this macro param ({klass}) in line: {line}"
                     .format(
                         klass=param_klass,