Error handling major refactoring
This commit is contained in:
1 parent
ddf860a51f
commit
b3bb241186
3 files changed
+14
-14
No files matched your search
Binary file not shown.
+1
-2
@@ -28,7 +28,6 @@
|
||||
<Content Include="this.bot.config.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Trading-Process\" />
|
||||
<Folder Include="bin" />
|
||||
<Folder Include="logs" />
|
||||
<Folder Include="logs\AA Masters" />
|
||||
@@ -41,7 +40,7 @@
|
||||
<Folder Include="obj\Debug" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Trading-Process\This.Bot.js" />
|
||||
<Compile Include="This.Bot.js" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<!--Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them.-->
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
logger.write("[INFO] initialize -> Entering function 'initialize' ");
|
||||
|
||||
callBackFunction(null);
|
||||
callBackFunction(DEFAULT_OK_RESPONSE);
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] initialize -> onDone -> err = " + err.message);
|
||||
callBackFunction("Operation Failed");
|
||||
callBackFunction(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,18 +64,19 @@
|
||||
function onDone(err) {
|
||||
try {
|
||||
|
||||
switch (err) {
|
||||
case null: {
|
||||
callBackFunction(null);
|
||||
switch (err.result) {
|
||||
case DEFAULT_OK_RESPONSE.result: {
|
||||
callBackFunction(DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'Retry Later': { // Something bad happened, but if we retry in a while it might go through the next time.
|
||||
case DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
|
||||
logger.write("[ERROR] start -> onDone -> Retry Later. Requesting Execution Retry.");
|
||||
callBackFunction(err.message);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'Retry Later': { // This is an unexpected exception that we do not know how to handle.
|
||||
case DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
|
||||
logger.write("[ERROR] start -> onDone -> Operation Failed. Aborting the process.");
|
||||
callBackFunction(err.message);
|
||||
return;
|
||||
@@ -85,7 +86,7 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> onDone -> err = " + err.message);
|
||||
callBackFunction("Operation Failed");
|
||||
callBackFunction(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +174,7 @@
|
||||
}
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> businessLogic -> err = " + err.message);
|
||||
callBack("Operation Failed");
|
||||
callBack(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +188,7 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> decideAboutBuyPosition -> err = " + err.message);
|
||||
callBack("Operation Failed");
|
||||
callBack(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,13 +258,13 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> decideAboutSellPosition -> err = " + err.message);
|
||||
callBack("Operation Failed");
|
||||
callBack(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] start -> err = " + err.message);
|
||||
callBackFunction("Operation Failed");
|
||||
callBackFunction(DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user