> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AlgorithmException Class

**Namespace:** `Phoenix.Optimization`

## Overview

This exception can be thrown by an algorithm when an algorithm specific code is raised.

## Inheritance

![AlgorithmException](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/docs/modelcenter/modelcenter-custom-optimization-algorithm-sdk/2026-r1/api/graphics/class_phoenix_1_1_optimization_1_1_algorithm_exception.png?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=52c08e041e8ddf253b0a8f8870a83d9b)

## Declaration

```csharp theme={null}
class AlgorithmException
```

## Description

This exception can be thrown by an algorithm when an algorithm specific code is raised.

## Public Member Functions

| Type | Name | Description |
| - | - | - |
| | `AlgorithmException (int code)` | Constructs `AlgorithmException` with a code |
| | `AlgorithmException (int code, string msg)` | Constructs exception with a code and message |
| | `AlgorithmException (int code, string msg, Exception inner)` | Constructs exception with a code, message and inner exception |
| override void | `GetObjectData (SerializationInfo info, StreamingContext context)` | When overridden in a derived class, sets the `SerializationInfo` with information about the exception. |

### Public Member Functions inherited from [OptimizationException]()

| Type | Name | Description |
| - | - | - |
| | `OptimizationException ()` | Initializes a new instance of the `OptimizationException` class. |
| | `OptimizationException (string msg)` | Initializes a new instance of the `OptimizationException` class with a specified error message. |
| | `OptimizationException (string msg, Exception inner)` | Initializes a new instance of the `OptimizationException` class with a specified error message and a reference to the inner exception that is the cause of this exception. |

## Properties

| Type | Name | Description |
| - | - | - |
| int | `Code [get]` | Gets the algorithm specific code that was raised |
| override string | `Message [get]` | Gets the error code and message used to create the `AlgorithmException`. |

## Constructor & Destructor Documentation

### AlgorithmException()

```csharp theme={null}
AlgorithmException ( int code)
```

Constructs `AlgorithmException` with a code

**Parameters:**

* `code` - Code for the exception

### AlgorithmException()

```csharp theme={null}
AlgorithmException ( int code, string msg )
```

Constructs exception with a code and message

**Parameters:**

* `code` - Code for the exception
* `msg` - Message for the exception

### AlgorithmException()

```csharp theme={null}
AlgorithmException ( int code, string msg, Exception inner )
```

Constructs exception with a code, message, and inner exception

**Parameters:**

* `code` - Code for the exception
* `msg` - Message for the exception
* `inner` - The exception that caused the algorithm exception to be thrown.

### AlgorithmException()

```csharp theme={null}
AlgorithmException ( SerializationInfo info, StreamingContext context )
```

Initializes a new instance of the `AlgorithmException` class with serialized data.

**Parameters:**

* `info` - The `SerializationInfo` that holds the serialized object data about the exception being thrown.
* `context` - The `StreamingContext` that contains contextual information about the source or destination.

## Member Function Documentation

### GetObjectData

```csharp theme={null}
override void `GetObjectData` ( SerializationInfo info, StreamingContext context )
```

When overridden in a derived class, sets the `SerializationInfo` with information about the exception.

**Parameters:**

* `info` - The `SerializationInfo` that holds the serialized object data about the exception being thrown.
* `context` - The `StreamingContext` that contains contextual information about the source or destination.

### Code

```csharp theme={null}
int Code
```

Gets the algorithm specific code that was raised

### Message

```csharp theme={null}
override string Message
```

Gets the error code and message used to create the `AlgorithmException`.

## Property Documentation

### Code

```csharp theme={null}
int Code
```

Gets the algorithm specific code that was raised

### Message

```csharp theme={null}
override string Message
```

Gets the error code and message used to create the `AlgorithmException`.
