Convert exception-reporter.js to typescript

Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-01-08 12:38:23 +01:00 committed by Lorenzo Alberto Maria Ambrosi
parent 596b316d65
commit fadfadd9e9
2 changed files with 9 additions and 19 deletions

View File

@ -37,6 +37,7 @@ const analytics = require('./modules/analytics')
const availableDrives = require('./models/available-drives')
const driveScanner = require('./modules/drive-scanner')
const osDialog = require('./os/dialog')
// eslint-disable-next-line node/no-missing-require
const exceptionReporter = require('./modules/exception-reporter')
// eslint-disable-next-line node/no-missing-require
const { updateLock } = require('./modules/update-lock')

View File

@ -14,27 +14,16 @@
* limitations under the License.
*/
'use strict'
const _ = require('lodash')
const analytics = require('../modules/analytics')
const osDialog = require('../os/dialog')
import { logException } from '../modules/analytics';
import { showError } from '../os/dialog';
/**
* @summary Report an exception
* @function
* @public
*
* @param {Error} exception - exception
*
* @example
* exceptionReporter.report(new Error('Something happened'));
*/
exports.report = (exception) => {
if (_.isUndefined(exception)) {
return
}
osDialog.showError(exception)
analytics.logException(exception)
export function report(exception?: Error) {
if (exception === undefined) {
return;
}
showError(exception);
logException(exception);
}