@azure/communication-react
Version:
React library for building modern communication user experiences utilizing Azure Communication Services
26 lines • 957 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* Error thrown from failed stateful API methods.
*
* @public
*/
export class CallError extends Error {
/** needs to be a (innerError as CommunicationServicesError) */
constructor(target, innerError, timestamp) {
super();
this.target = target;
this.innerError = innerError;
if ('code' in innerError) {
this.code = innerError.code;
}
if ('subCode' in innerError) {
this.subCode = innerError.subCode;
}
// Testing note: It is easier to mock Date::now() than the Date() constructor.
this.timestamp = timestamp !== null && timestamp !== void 0 ? timestamp : new Date(Date.now());
this.name = 'CallError';
this.message = `${this.target}: ${this.innerError.message} code=${this.code} subCode=${this.subCode}`;
}
}
//# sourceMappingURL=CallClientState.js.map