BUGFIX: Fix inconsistencies of error handling in promise-based API (#1377)

This commit is contained in:
catloversg
2024-08-18 04:23:08 +07:00
committed by GitHub
parent 701c5d8e64
commit 94eef8ecde
3 changed files with 24 additions and 30 deletions
+1 -2
View File
@@ -559,8 +559,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
helpers.checkSingularityAccess(ctx);
const baseserver = Player.getCurrentServer();
if (!(baseserver instanceof Server)) {
helpers.log(ctx, () => "Cannot backdoor this kind of server");
return Promise.resolve();
throw helpers.errorMessage(ctx, "Cannot backdoor this kind of server.");
}
const server = baseserver;
const installTime = (calculateHackingTime(server, Player) / 4) * 1000;