# self.message = message
Exception.__init__(self, format_position(position) + message)
-
class InternalError(Exception):
# If this is ever raised, there is a bug in the compiler.
Exception.__init__(self, u"Internal compiler error: %s"
% message)
+class AbortError(Exception):
+ # Throw this to stop the compilation immediately.
+
+ def __init__(self, message):
+ self.message_only = message
+ Exception.__init__(self, u"Abort error: %s" % message)
class CompilerCrash(CompileError):
# raised when an unexpected exception occurs in a transform
echo_file.write(line.encode('ASCII', 'replace'))
num_errors = num_errors + 1
if Options.fatal_errors:
- raise InternalError, "abort"
+ raise AbortError, "fatal errors"
def error(position, message):
#print "Errors.error:", repr(position), repr(message) ###
import Parsing
import Version
from Scanning import PyrexScanner, FileSourceDescriptor
-from Errors import PyrexError, CompileError, InternalError, error, warning
+from Errors import PyrexError, CompileError, InternalError, AbortError, error, warning
from Symtab import BuiltinScope, ModuleScope
from Cython import Utils
from Cython.Utils import open_new_file, replace_suffix
def abort_on_errors(node):
# Stop the pipeline if there are any errors.
if Errors.num_errors != 0:
- raise InternalError, "abort"
+ raise AbortError, "pipeline break"
return node
class CompilationData(object):
error = None
data = source
try:
- for phase in pipeline:
- if phase is not None:
- if DebugFlags.debug_verbose_pipeline:
- t = time()
- print "Entering pipeline phase %r" % phase
- data = phase(data)
- if DebugFlags.debug_verbose_pipeline:
- print " %.3f seconds" % (time() - t)
- except CompileError, err:
- # err is set
- Errors.report_error(err)
- error = err
+ try:
+ for phase in pipeline:
+ if phase is not None:
+ if DebugFlags.debug_verbose_pipeline:
+ t = time()
+ print "Entering pipeline phase %r" % phase
+ data = phase(data)
+ if DebugFlags.debug_verbose_pipeline:
+ print " %.3f seconds" % (time() - t)
+ except CompileError, err:
+ # err is set
+ Errors.report_error(err)
+ error = err
except InternalError, err:
# Only raise if there was not an earlier error
if Errors.num_errors == 0:
raise
error = err
+ except AbortError, err:
+ error = err
return (error, data)
def find_module(self, module_name,