mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-19 01:06:36 +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 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')
|
||||
|
@ -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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user