UNPKG

infobip-rtc

Version:

Infobip RTC JavaScript SDK - Infobip WebRTC API Implementation

33 lines 1.33 kB
import { ApplicationErrorCode } from "../ApplicationErrorCode"; class HangupStatusFactory { static getApplicationHangupStatus(error) { if (!error || (!error.name && !error.message)) { return ApplicationErrorCode.UNKNOWN; } switch (error.name) { case ("NotAllowedError"): return ApplicationErrorCode.DEVICE_FORBIDDEN; case ("NotFoundError"): return ApplicationErrorCode.DEVICE_NOT_FOUND; case ("NotReadableError"): return ApplicationErrorCode.DEVICE_UNAVAILABLE; } if ((error === null || error === void 0 ? void 0 : error.id) && (error === null || error === void 0 ? void 0 : error.name) && (error === null || error === void 0 ? void 0 : error.description)) { return { id: error.id, name: error.name, description: error.description }; } let errorDescription = ''; if (error.name) { errorDescription += error.name + ' '; } if (error.message) { errorDescription += error.message; } return { id: '10310', name: 'UNKNOWN', description: errorDescription }; } } export default HangupStatusFactory; //# sourceMappingURL=HangupStatusFactory.js.map