@@ -136,7 +136,7 @@ export async function getDatabaseByConnectionType(connectionType?: string): Prom
136
136
let response : object = { } ;
137
137
response = await asyncFilter ( allDataBases , async ( item : databaseParameters ) => {
138
138
await doAsyncStuff ( ) ;
139
- return await item . connectionType === connectionType ;
139
+ return item . connectionType === connectionType ;
140
140
} ) ;
141
141
return await response [ 0 ] . id ;
142
142
}
@@ -167,10 +167,14 @@ export async function deleteAllDatabasesApi(): Promise<void> {
167
167
*/
168
168
export async function deleteStandaloneDatabaseApi ( databaseParameters : AddNewDatabaseParameters ) : Promise < void > {
169
169
const databaseId = await getDatabaseIdByName ( databaseParameters . databaseName ) ;
170
+ if ( databaseId ) {
170
171
await request ( endpoint ) . delete ( '/databases' )
171
172
. send ( { 'ids' : [ `${ databaseId } ` ] } )
172
173
. set ( 'Accept' , 'application/json' )
173
174
. expect ( 200 ) ;
175
+ } else {
176
+ throw new Error ( 'Error: Missing databaseId' ) ;
177
+ }
174
178
}
175
179
176
180
/**
@@ -185,6 +189,8 @@ export async function deleteStandaloneDatabasesByNamesApi(databaseNames: string[
185
189
. send ( { 'ids' : [ `${ databaseId } ` ] } )
186
190
. set ( 'Accept' , 'application/json' )
187
191
. expect ( 200 ) ;
192
+ } else {
193
+ throw new Error ( 'Error: Missing databaseId' ) ;
188
194
}
189
195
} ) ;
190
196
}
@@ -229,8 +235,8 @@ export async function deleteAllDatabasesByConnectionTypeApi(connectionType: stri
229
235
* @param databasesParameters The databases parameters as array
230
236
*/
231
237
export async function deleteStandaloneDatabasesApi ( databasesParameters : AddNewDatabaseParameters [ ] ) : Promise < void > {
232
- if ( await databasesParameters . length ) {
233
- await databasesParameters . forEach ( async parameter => {
238
+ if ( databasesParameters . length ) {
239
+ databasesParameters . forEach ( async parameter => {
234
240
await deleteStandaloneDatabaseApi ( parameter ) ;
235
241
} ) ;
236
242
}
0 commit comments