Edit

Share via


SPError class

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

The purpose of this class is to help make the SharePoint framework errors more robust. On top of the base Error class functionality, this class adds the concept of error codes. The error code could be a non-localized immutable string or an error number. All the SharePoint framework code is expected to use this class for raising errors.

References:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error

http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript

Extends

Error

Constructors

(constructor)(errorCode, message, logProperties)

Constructor for the SPError class.

Properties

category

Error category.

id

Error id. e.g. Value of the enum.

innerError

Inner error.

Constructor Details

(constructor)(errorCode, message, logProperties)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Constructor for the SPError class.

constructor(errorCode: string, message: string, logProperties?: {
        [key: string]: any;
    });

Parameters

errorCode

string

a numeric or string error code.

message

string

detailed error message.

logProperties

{ [key: string]: any; }

(optional) additional data that can be used to troubleshoot rare to repro bugs.

Property Details

category

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Error category.

get category(): string;

Property Value

string

id

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Error id. e.g. Value of the enum.

get id(): number;

Property Value

number

innerError

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Inner error.

innerError: Error | undefined;

Property Value

Error | undefined