mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-19 17:26:34 +00:00
Convert exception-reporter.js to typescript
Change-type: patch
This commit is contained in:
parent
596b316d65
commit
fadfadd9e9
@ -37,6 +37,7 @@ const analytics = require('./modules/analytics')
|
|||||||
const availableDrives = require('./models/available-drives')
|
const availableDrives = require('./models/available-drives')
|
||||||
const driveScanner = require('./modules/drive-scanner')
|
const driveScanner = require('./modules/drive-scanner')
|
||||||
const osDialog = require('./os/dialog')
|
const osDialog = require('./os/dialog')
|
||||||
|
// eslint-disable-next-line node/no-missing-require
|
||||||
const exceptionReporter = require('./modules/exception-reporter')
|
const exceptionReporter = require('./modules/exception-reporter')
|
||||||
// eslint-disable-next-line node/no-missing-require
|
// eslint-disable-next-line node/no-missing-require
|
||||||
const { updateLock } = require('./modules/update-lock')
|
const { updateLock } = require('./modules/update-lock')
|
||||||
|
@ -14,27 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict'
|
import { logException } from '../modules/analytics';
|
||||||
|
import { showError } from '../os/dialog';
|
||||||
const _ = require('lodash')
|
|
||||||
const analytics = require('../modules/analytics')
|
|
||||||
const osDialog = require('../os/dialog')
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Report an exception
|
* @summary Report an exception
|
||||||
* @function
|
|
||||||
* @public
|
|
||||||
*
|
|
||||||
* @param {Error} exception - exception
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* exceptionReporter.report(new Error('Something happened'));
|
|
||||||
*/
|
*/
|
||||||
exports.report = (exception) => {
|
export function report(exception?: Error) {
|
||||||
if (_.isUndefined(exception)) {
|
if (exception === undefined) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
showError(exception);
|
||||||
osDialog.showError(exception)
|
logException(exception);
|
||||||
analytics.logException(exception)
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user