Class WinccoaError

Error class that contains additional information found in WinCC OA errors, like the WinCC OA error code.

Example: Getting error details - TypeScript

import { WinccoaManager, WinccoaError } from 'winccoa-manager';
const winccoa = new WinccoaManager();

try {
...
} catch(exc) {
// standard reporting
console.error(exc);

// access the details
var oaError = exc as WinccoaError;
console.warn('Error code : ' + oaError.code);
console.warn('Error message : ' + oaError.message);
console.warn('Catalogue : ' + oaError.catalog);
console.warn('Details : ' + oaError.details);
}

Example: Getting error details - JavaScript

const { WinccoaManager } = require('winccoa-manager');
const winccoa = new WinccoaManager();

try {
...
} catch(exc) {
// standard reporting
console.error(exc);

// access the details
console.warn('Error code : ' + exc.code);
console.warn('Error message : ' + exc.message);
console.warn('Catalogue : ' + exc.catalog);
console.warn('Details : ' + exc.details);
}

Hierarchy

  • Error
    • WinccoaError

Constructors

  • Constructor. This constructor is also used by the WinccoaManager to create WinccoaError instances.

    Parameters

    • code: string | number

      WincCC OA error code. This can either be a number (like 71 for "DP does not exist") or a string. The meaning of string error codes can be found in the corresponding catalog.

    • message: string

      Error message corresponding to code.

    • catalog: string = ''

      Name of the error catalog where the error message can be found. If empty, this refers to catalog _errors.cat.

    • Optional details: unknown

      Additional details specific to that error. Not all errors provide this information.

    Returns WinccoaError

Properties

catalog: string = ''

Name of the error catalog where the error message can be found. If empty, this refers to catalog _errors.cat.

code: string | number

WincCC OA error code. This can either be a number (like 71 for "DP does not exist") or a string. The meaning of string error codes can be found in the corresponding catalog.

details?: unknown

Additional details specific to that error. Not all errors provide this information.

message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

    • (err, stackTraces): any
    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void