@@ -55,12 +55,26 @@ export const addRunning = (runningList, callback) => {
55
55
* @param {* } callback
56
56
* @param {* } runningList
57
57
*/
58
+
59
+ const errorsCalled = { } ;
60
+
61
+ const errorCheck = ( key , error ) => {
62
+ if ( ! errorsCalled [ key ] ) {
63
+ errorsCalled [ key ] = error . message ;
64
+ alert ( `Make sure Docker Desktop is running. \n\n ${ error . message } ` ) ;
65
+ }
66
+ else {
67
+ console . log ( error . message ) ;
68
+ }
69
+ return
70
+ }
71
+
58
72
export const refreshRunning = ( refreshRunningContainers ) => {
59
73
exec (
60
74
'docker stats --no-stream --format "{{json .}},"' ,
61
75
( error , stdout , stderr ) => {
62
76
if ( error ) {
63
- alert ( ` ${ error . message } ` ) ;
77
+ errorCheck ( "refreshRunning" , error ) ;
64
78
return ;
65
79
}
66
80
if ( stderr ) {
@@ -89,7 +103,7 @@ export const refreshStopped = (refreshStoppedContainers) => {
89
103
'docker ps -f "status=exited" --format "{{json .}},"' ,
90
104
( error , stdout , stderr ) => {
91
105
if ( error ) {
92
- alert ( ` ${ error . message } ` ) ;
106
+ errorCheck ( "refreshStopped" , error ) ;
93
107
return ;
94
108
}
95
109
if ( stderr ) {
@@ -113,7 +127,7 @@ export const refreshStopped = (refreshStoppedContainers) => {
113
127
export const refreshImages = ( callback ) => {
114
128
exec ( 'docker images' , ( error , stdout , stderr ) => {
115
129
if ( error ) {
116
- alert ( ` ${ error . message } ` ) ;
130
+ errorCheck ( "refreshImages" , error ) ;
117
131
return ;
118
132
}
119
133
if ( stderr ) {
0 commit comments