---
title: clsAppError
summary: API reference for clsAppError.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Application.LogView
reference_type: package
---

# clsAppError

`clsAppError` is the single-row BOF business object for `App_Error`. It creates new error rows, retrieves one row by sequence number, and exposes the loaded error data through public properties.

## Purpose
- Create and save one application error row.
- Retrieve one application error row by `AppErrorSeqNum`.
- Expose the row state used by log-view callers.

## Context
- Namespace: `SAIF.Application.LogView`
- Assembly/package: `SAIF.Application.LogView`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `AppErrorSeqNum` | `Public Property AppErrorSeqNum() As Integer` | Exposes the identity value for the current error row. |
| `AppName` | `Public Property AppName() As String` | Exposes the application name stored with the error row. |
| `Environment` | `Public Property Environment() As String` | Exposes the environment stored with the error row. |
| `ErrorDate` | `Public Property ErrorDate() As Date` | Exposes the logged error timestamp. |
| `ErrorInfo` | `Public Property ErrorInfo() As String` | Exposes the captured error text. |
| `ErrorAsHTML` | `Public ReadOnly Property ErrorAsHTML() As String` | Returns `ErrorInfo` with carriage-return line breaks converted to `<br>`. |
| `ErrorSource` | `Public Property ErrorSource() As String` | Exposes the error source value. |
| `MachineName` | `Public Property MachineName() As String` | Exposes the machine name stored with the error row. |
| `PageName` | `Public Property PageName() As String` | Exposes the page name stored with the error row. |
| `StateInfo` | `Public Property StateInfo() As String` | Exposes supplemental state text captured with the error. |
| `StateAsHTML` | `Public ReadOnly Property StateAsHTML() As String` | Returns `StateInfo` with carriage-return line breaks converted to `<br>`. |
| `UserName` | `Public Property UserName() As String` | Exposes the user name stored with the error row. |
| `DeletedFlag` | `Public Property DeletedFlag() As String` | Exposes the soft-delete flag used by the update path. |
| `MyCriteria` | `Public ReadOnly Property MyCriteria() As Criteria` | Returns the attached `clsAppError.Criteria` instance. |
| `IsValid` | `Public Overrides ReadOnly Property IsValid() As Boolean` | Returns the BOF validity result for this object. |
| `IsSavable` | `Public Overrides ReadOnly Property IsSavable() As Boolean` | Returns the BOF savable-state result for this object. |
| `Equals` | `Public Overloads Shared Function Equals(ByVal objA As Object, ByVal objB As Object) As Boolean` | Compares two objects by delegating to the typed `Equals` overload when both are `clsAppError`. |
| `Equals` | `Public Overloads Overrides Function Equals(ByVal inObject As Object) As Boolean` | Compares this instance to another object when it is a `clsAppError`. |
| `Equals` | `Public Overloads Function Equals(ByVal inObject As clsAppError) As Boolean` | Compares two `clsAppError` instances by `AppErrorSeqNum`. |
| `GetHashCode` | `Public Overrides Function GetHashCode() As Integer` | Returns the hash code of `AppErrorSeqNum`. |
| `ToString` | `Public Overrides Function ToString() As String` | Returns `AppErrorSeqNum` as a string. |
| `CreateNewAppError` | `Public Shared Function CreateNewAppError(inDPI As IDataPortalInfo, inErrorStruct As SAIF.Framework.Logging.ErrorInfoStruct) As clsAppError` | Creates, populates, saves, and returns a new error object from `ErrorInfoStruct`. |
| `CreateNewAppError` | `Public Shared Function CreateNewAppError(inDPI As IDataPortalInfo, inAppName As String, inEnvironment As String, inErrorDate As DateTime, inErrorInfo As String, inErrorSource As String, inMachineName As String, inPageName As String, inStateInfo As String, inUserName As String) As clsAppError` | Creates, populates, saves, and returns a new error object from discrete values. |
| `GetAppError` | `Public Shared Function GetAppError(ByVal inDataportal As IDataPortalInfo, ByVal inAppErrorSeqNum As Integer) As clsAppError` | Retrieves one error object by sequence number. |

## Behavioral notes
- Insert operations execute [SQL-003](../../sql/SQL-003-saif-application-logview.md) and then [SQL-001](../../sql/SQL-001-saif-application-logview.md) to capture the identity value.
- `AfterRetrieve` accepts exactly one returned row and otherwise throws `ApplicationException("Invalid Results")`, which aligns with [BR-005](../../business-rules.md#br-005-single-object-retrieval-requires-exactly-one-row).
- `AfterInsert` adds `InsertError` when the insert affects anything other than one row, which aligns with [BR-006](../../business-rules.md#br-006-inserts-must-affect-exactly-one-row).

## Constraints and usage notes
- Most row properties use private setters in source, so callers populate them through the factory methods or BOF load path.
- `DeletedFlag` is the only row property with a public setter in this type.

## Sources
- `Application\SAIF.Application.LogView\clsAppError.vb`
