File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2022 Nordic Semiconductor ASA
3
+ *
4
+ * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
5
+ */
6
+
7
+ export const cleanIpcErrorMessage = ( message , replacecment = '' ) =>
8
+ message . replace (
9
+ / E r r o r i n v o k i n g r e m o t e m e t h o d ' .* ?' : * ( E r r o r : ) ? * / ,
10
+ replacecment
11
+ ) ;
Original file line number Diff line number Diff line change 8
8
9
9
import { ErrorDialogActions } from 'pc-nrfconnect-shared' ;
10
10
11
+ import { cleanIpcErrorMessage } from '../../ipc/error' ;
11
12
import {
12
13
invokeGetFromRenderer as getSetting ,
13
14
sendSetFromRenderer as setSetting ,
@@ -121,7 +122,14 @@ export function addSource(url) {
121
122
addSourceInMain ( url )
122
123
. then ( source => dispatch ( addSourceAction ( source , url ) ) )
123
124
. catch ( error =>
124
- dispatch ( ErrorDialogActions . showDialog ( error . message ) )
125
+ dispatch (
126
+ ErrorDialogActions . showDialog (
127
+ cleanIpcErrorMessage (
128
+ error . message ,
129
+ 'Error while trying to add a source: '
130
+ )
131
+ )
132
+ )
125
133
)
126
134
. then ( ( ) => dispatch ( AppsActions . loadOfficialApps ( ) ) ) ;
127
135
} ;
@@ -141,6 +149,16 @@ export function removeSource(name) {
141
149
. then ( ( ) => dispatch ( AppsActions . loadOfficialApps ( ) ) )
142
150
. then ( async ( ) =>
143
151
dispatch ( await AppsActions . setAppManagementSource ( name ) )
152
+ )
153
+ . catch ( error =>
154
+ dispatch (
155
+ ErrorDialogActions . showDialog (
156
+ cleanIpcErrorMessage (
157
+ error . message ,
158
+ `Error while trying to remove the source '${ name } ': `
159
+ )
160
+ )
161
+ )
144
162
) ;
145
163
} ;
146
164
}
You can’t perform that action at this time.
0 commit comments