# ServerSheetControlException Constructor

> ServerSheetControlException constructor in the TX Sheet Control .NET API, with the parameters code and message and a C# example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Constructor
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > ServerSheetControlException > ServerSheetControlException Constructor
- **654 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/constructor/llms-full.txt

---

### Syntax

```csharp
public ServerSheetControlException(string code, string message)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `code` | `string` | No | Value matching code's declared type and the owning object's validation rules. |
| `message` | `string` | No | Value matching message's declared type and the owning object's validation rules. |

### Return Value

`ServerSheetControlException`.

### Examples

Convert an application-supplied workbook and return a structured failure to the caller. Missing or invalid licenses fail; configure a valid signed token before retrying.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<(byte[]? Pdf, string? Error)> TryConvertInvoiceAsync(byte[] workbookBytes, string signedLicense)
{
    try
    {
        await using var control = new ServerSheetControl(new ServerSheetControlOptions { License = signedLicense });
        await control.LoadAsync(workbookBytes, StreamType.SpreadsheetML);
        return (await control.SaveAsync(StreamType.PDF), null);
    }
    catch (ServerSheetControlException error)
    {
        return (null, error.Code + ": " + error.Message);
    }
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [ServerSheetControlException Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## Nearby

- **Previous:** [ServerSheetControlException Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/llms-full.txt)
- **Next:** [ServerSheetControlException.Code Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrolexception/code-property/llms-full.txt)
