PeterO.Numbers.ETrapException

## PeterO.Numbers.ETrapException

public sealed class ETrapException :
    System.ArithmeticException,
    System.Runtime.InteropServices._Exception,
    System.Runtime.Serialization.ISerializable

Exception thrown for arithmetic trap errors. (The “E” stands for “extended”, and has this prefix to group it with the other classes common to this library, particularly EDecimal, EFloat, and ERational.). This library may throw exceptions of this type in certain cases, notably when errors occur, and may supply messages to those exceptions (the message can be accessed through the Message property in.NET or the getMessage() method in Java). These messages are intended to be read by humans to help diagnose the error (or other cause of the exception); they are not intended to be parsed by computer programs, and the exact text of the messages may change at any time between versions of this library.

Member Summary

### ETrapException Constructor

public ETrapException(
    int flag,
    PeterO.Numbers.EContext ctx,
    object result);

Initializes a new instance of the PeterO.Numbers.ETrapException class.

Parameters:

### ETrapException Constructor

public ETrapException(
    int flags,
    int flag,
    PeterO.Numbers.EContext ctx,
    object result);

Initializes a new instance of the PeterO.Numbers.ETrapException class.

Parameters:

Exceptions:

### ETrapException Constructor

public ETrapException(
    string message);

Initializes a new instance of the PeterO.Numbers.ETrapException class.

Parameters:

### ETrapException Constructor

public ETrapException(
    string message,
    System.Exception innerException);

Initializes a new instance of the PeterO.Numbers.ETrapException class.

Parameters:

### ETrapException Constructor

public ETrapException();

Initializes a new instance of the PeterO.Numbers.ETrapException class.

### Context

public PeterO.Numbers.EContext Context { get; }

Gets the arithmetic context used during the operation that triggered the trap. May be null.

Returns:

The arithmetic context used during the operation that triggered the trap. May be null.

### Error

public int Error { get; }

Gets the flag that specifies the primary kind of error in one or more operations (EContext.FlagXXX). This will only be one flag, such as FlagInexact or FlagSubnormal.

Returns:

The flag that specifies the primary kind of error in one or more operations.

### Errors

public int Errors { get; }

Gets the flags that were signaled as the result of one or more operations. This includes the flag specified in the “flag” parameter, but can include other flags. For instance, if “flag” is EContext.FlagInexact , this parameter might be EContext.FlagInexact | EContext.FlagRounded .

Returns:

The flags that specify the errors in one or more operations.

### Result

public object Result { get; }

Gets the defined result of the operation that caused the trap.

Returns:

The defined result of the operation that caused the trap.

### HasError

public bool HasError(
    int flag);

Returns whether this trap exception specifies all the flags given. (Flags are signaled in a trap exception as the result of one or more operations involving arbitrary-precision numbers, such as multiplication of two EDecimals.).

Parameters:

Return Value:

True if this exception pertains to all of the flags given in flag ; otherwise, false.

Back to Numbers start page.