Skip to main content

Class XperiflowApiException

Represents an exception that occurs during Xperiflow API operations.

Namespace: Workspace.XBR.Xperiflow.Core.RestApi.Exceptions

Assembly: Xperiflow.dll

Declaration
public class XperiflowApiException : Exception, ISerializable, IApiException

Inheritance: System.Object -> System.Exception

Examples

// Creating an API exception with session information
var apiException = new XperiflowApiException(
sessionInfo,
"API request failed",
500,
responseBody,
headers,
innerException);

// Handle the exception
throw apiException.Handle();

Remarks

This exception class provides detailed information about API failures, including HTTP status codes, response content, and headers. It implements the Workspace.XBR.Xperiflow.Core.RestApi.Exceptions.IApiException interface to ensure consistent error handling throughout the Xperiflow system.

The exception can be used with or without Xperiflow session information. When session information is available, the exception can be properly logged and handled within the OneStream error handling system.

Implements: System.Runtime.Serialization.ISerializable, Workspace.XBR.Xperiflow.Core.RestApi.Exceptions.IApiException

Properties

StatusCode

Gets the HTTP status code returned by the failed API request.

Declaration
public int StatusCode { get; }
Remarks

This status code indicates the type of failure that occurred and can be used to determine the appropriate response or retry strategy.

Response

Gets the raw HTTP response body content from the failed API request.

Declaration
public string? Response { get; }
Remarks

The response body typically contains detailed error information from the API, including error messages and additional context.

Headers

Gets the HTTP response headers associated with the failed API request.

Declaration
public IReadOnlyDictionary<string, IEnumerable<string>> Headers { get; }
Remarks

These headers can provide additional context about the API failure, including rate limiting information and server details.

Methods

Handle()

Handles the API exception by converting it to an appropriate OneStream exception.

Declaration
public Exception Handle()
Remarks

This method transforms the API exception into a form that's appropriate for the OneStream application's error handling system. It ensures that the exception is properly logged and can be displayed to users in a meaningful way.

If no session information is available, this method will return a generic exception that may not be handled as gracefully by the OneStream error handling system.

Returns

System.Exception

A OneStream XFException that can be thrown to propagate the error through the OneStream error handling system with proper logging.

Exceptions

OneStream.Shared.Common.XFException Thrown when session information is available and the exception can be properly logged in the OneStream error handling system.

ToString()

Returns a string representation of the API exception including HTTP response details.

Declaration
public override string ToString()
Remarks

This method provides a detailed string representation that includes both the HTTP response content and the standard exception information, making it particularly useful for logging and debugging API failures.

Returns

System.String

A formatted string containing the HTTP response and standard exception information.

Implements

Inherited Members

  • System.Exception.GetBaseException
  • System.Exception.GetType
  • System.Exception.Data
  • System.Exception.HelpLink
  • System.Exception.HResult
  • System.Exception.InnerException
  • System.Exception.Message
  • System.Exception.Source
  • System.Exception.StackTrace
  • System.Exception.TargetSite
  • System.Exception.SerializeObjectState
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object,System.Object)
  • System.Object.GetHashCode
  • System.Object.MemberwiseClone
  • System.Object.ReferenceEquals(System.Object,System.Object)

Was this page helpful?