Orchestrator Function: Log Exception Details

by Simon Sparks · 20 January 2026

To use this function add it to the class library file named Utilities.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: Utilities.ts

Function logException

Description: Orchestrator Function to Sort an Array of Strings

public static logException(objException: Error, objLogger: Logger, strFunctionName: string, strCustomErrorMessage: string = ""): void {

  let objError: Error = objException as Error;

  objLogger.error(`${strFunctionName} - Name: ${objError.name}`);
  objLogger.error(`${strFunctionName} - Message: ${objError.message}`);

  if (objError.stack) {
    objLogger.error(`${strFunctionName} - Message: ${objError.message}`);
  }

  if (strCustomErrorMessage !== "") {
    objLogger.error(`${strFunctionName} - Custom Error Message: ${strCustomErrorMessage}`);
  }
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like