mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 20:26:36 +00:00
Try to get more information about error messages (#464)
If the error object is not well-formed, try to get as most information about it as we can instead of just realying on generic error messages. Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
parent
f2a8860135
commit
7d5f42f38c
@ -88,7 +88,13 @@ module.exports = function($q, SupportedFormatsModel) {
|
|||||||
*/
|
*/
|
||||||
this.showError = function(error) {
|
this.showError = function(error) {
|
||||||
error = error || {};
|
error = error || {};
|
||||||
electron.remote.dialog.showErrorBox(error.message || 'An error ocurred!', error.stack || '');
|
|
||||||
|
// Try to get as most information as possible about the error
|
||||||
|
// rather than falling back to generic messages right away.
|
||||||
|
const title = error.message || error.code || 'An error ocurred';
|
||||||
|
const message = error.stack || JSON.stringify(error) || '';
|
||||||
|
|
||||||
|
electron.remote.dialog.showErrorBox(title, message);
|
||||||
|
|
||||||
// Also throw it so it gets displayed in DevTools
|
// Also throw it so it gets displayed in DevTools
|
||||||
// and its reported by TrackJS.
|
// and its reported by TrackJS.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user