Skip to content

Commit fd6286d

Browse files
committed
fix: do not fail out init if drag and drop fails
1 parent 6a79ad2 commit fd6286d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/app/core.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ export const testConnection = (): Promise<any> => {
2222

2323
/**
2424
* Initialize drag and drop.
25+
* @param initCall - Indicate if called via init flow and should not reject
2526
*
2627
* @returns a promise that resolves if the initialization was successful or not
2728
*/
28-
export const initDragDrop = (): Promise<boolean> => {
29+
export const initDragDrop = (initCall?: boolean): Promise<boolean> => {
2930
if (!asperaSdk.isReady) {
3031
return throwError(messages.serverNotVerified);
3132
}
@@ -36,7 +37,13 @@ export const initDragDrop = (): Promise<boolean> => {
3637
.then((data: boolean) => promiseInfo.resolver(data))
3738
.catch(error => {
3839
errorLog(messages.dragDropInitFailed, error);
39-
promiseInfo.rejecter(generateErrorBody(messages.dragDropInitFailed, error));
40+
41+
if (initCall) {
42+
promiseInfo.resolver(false);
43+
errorLog(messages.dragDropInitFailedInit, error);
44+
} else {
45+
promiseInfo.rejecter(generateErrorBody(messages.dragDropInitFailed, error));
46+
}
4047
});
4148

4249
return promiseInfo.promise;
@@ -73,7 +80,7 @@ export const init = (options?: InitOptions): Promise<any> => {
7380

7481
return asperaSdk.activityTracking.setup()
7582
.then(() => testConnection())
76-
.then(() => initDragDrop())
83+
.then(() => initDragDrop(true))
7784
.catch(error => {
7885
errorLog(messages.serverError, error);
7986
asperaSdk.globals.asperaAppVerified = false;

src/constants/messages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export const messages = {
33
callbackIsNotFunction: 'The provided callback is not a function',
44
dragDropInitFailed: 'Unable to initialize drag-drop',
5+
dragDropInitFailedInit: 'Unable to initialize drag-drop as part of init flow',
56
failedToGenerateIframe: 'Unable to generate IFRAME for download. Using new window',
67
getInstallerError: 'Unable to get latest installers',
78
getAllTransfersFailed: 'Unable to get all transfers',

0 commit comments

Comments
 (0)