Encapsulates information about the result that should be produced when a OldDynamicAction cannot be performed. The ErrorInfo can hold one of: an expression which creates an Exception to be thrown an expression which produces a value which should be returned directly to the user and represents an error has occured (for example undefined in JavaScript) an expression which produces a value which should be returned directly to the user but does not actually represent an error. ErrorInfo's are produced by an ActionBinder in response to a failed binding.
Exemple #1
0
 public static DynamicMetaObject MakeError(ErrorInfo error, BindingRestrictions restrictions, Type type)
 {
     switch (error.Kind) {
         case ErrorInfoKind.Error:
             return new ErrorMetaObject(AstUtils.Convert(error.Expression, type), restrictions);
         case ErrorInfoKind.Exception:
             return new ErrorMetaObject(AstUtils.Convert(Expression.Throw(error.Expression), type), restrictions);
         case ErrorInfoKind.Success:
             return new ErrorMetaObject(AstUtils.Convert(error.Expression, type), restrictions);
         default:
             throw new InvalidOperationException();
     }
 }
Exemple #2
0
 public static DynamicMetaObject MakeError(ErrorInfo error, BindingRestrictions restrictions) {
     return new DynamicMetaObject(MakeError(error), restrictions);
 }
Exemple #3
0
 public static Expression MakeError(ErrorInfo error) {
     switch (error.Kind) {
         case ErrorInfoKind.Error:
             // error meta objecT?
             return error.Expression;
         case ErrorInfoKind.Exception:
             return Expression.Throw(error.Expression);
         case ErrorInfoKind.Success:
             return error.Expression;
         default:
             throw new InvalidOperationException();
     }
 }
Exemple #4
0
 public static DynamicMetaObject MakeError(ErrorInfo error, Type type) {
     return MakeError(error, BindingRestrictions.Empty, type);
 }
Exemple #5
0
 public static MetaObject MakeError(ErrorInfo error, Restrictions restrictions) {
     return new MetaObject(MakeError(error), restrictions);
 }
Exemple #6
0
 public static Expression MakeError(ErrorInfo error, Type type) {
     switch (error.Kind) {
         case ErrorInfoKind.Error:
             // error meta objecT?
             return AstUtils.Convert(error.Expression, type);
         case ErrorInfoKind.Exception:
             return AstUtils.Convert(Expression.Throw(error.Expression), type);
         case ErrorInfoKind.Success:
             return error.Expression;
         default:
             throw new InvalidOperationException();
     }
 }