Exemple #1
0
 public void PrintWarning(ErrorException e)
 {
     Debug.Assert(e != null);
     
     // The cousin to PrintError.
     // *Every* single user-warning comes through here.        
     // Note that there is no ThrowWarning because a warning, by nature,
     // should only be informative and not require a change in flow-control.
     PrettyPrintError(e.Code, e.Location, e.Message);
 }
Exemple #2
0
 // ThrowError is a convenience function. Many times a user error is an 
 // exceptional case that requires major control flow. We use exception
 // handling for that. This lets us aboid having to check for error cases 
 // all over the place.    
 //
 // If an error is more of a casual observation that doesn't really get in our 
 // way but will ultimately fail CodeGen, then use PrintError instead of ThrowError.
 public void ThrowError(ErrorException e)
 {
     PrintError(e);
     throw e;
 }
Exemple #3
0
//-----------------------------------------------------------------------------
// Blue has a single unified error subsystem, with error codes & checking
// partitioned across the different sub-systems.
//
// All users errors (ie, resulting from incorrect source file) must create
// a ErrorException object and send it through PrintError.
// This ensures standard error reporting & tracking.
//
// Note that this does mean that we have to create an exception object for
// every single error. This is ok because errors are rare. It is more 
// important to have strong (robust & flexible) error handling then fast
// handling. 
//-----------------------------------------------------------------------------
    
    public void PrintError(ErrorException e)
    {
        Debug.Assert(e != null);
        
        // *Every* single user-error comes through here.
        // This does not include internal errors & exceptions (such as File-not-found).
        // However, if those exceptions impact the user, then they are converted to a
        // ErrorException and then they come through here.
        PrettyPrintError(e.Code, e.Location, e.Message);
    }