Permalink
Browse files

Remove PlayerDisconnectError

Players disconnecting is not exceptional. Fixes #441
  • Loading branch information...
RussellLVP committed Jan 11, 2017
1 parent 8ded695 commit 54220133d9c23ed0c41130dce91efd730553c7a2
@@ -1,19 +0,0 @@
-// Copyright 2015 Las Venturas Playground. All rights reserved.
-// Use of this source code is governed by the MIT license, a copy of which can
-// be found in the LICENSE file.
-
-const NAME = 'PlayerDisconnectError';
-const MESSAGE = 'The player has disconnected from the server.';
-
-// The PlayerDisconnectError represents an exception that should be thrown when the player has
-// disconnected from Las Venturas Playground while an asynchronous operation was in progress.
-class PlayerDisconnectError extends Error {
- constructor() {
- super(MESSAGE);
-
- this.name = NAME;
- this.message = MESSAGE;
- }
-};
-
-exports = PlayerDisconnectError;
@@ -2,8 +2,6 @@
// Use of this source code is governed by the MIT license, a copy of which can
// be found in the LICENSE file.
-const PlayerDisconnectError = require('base/errors/player_disconnect_error.js');
-
// The dialog manager manages allocation of the dialog ids to individual dialogs that should be
// shown to users. The SA-MP server imposes a maximum of 32767 dialogs to exist at any given time,
// but the dynamic nature of JavaScript allows us to intelligently get around that.
@@ -67,9 +65,7 @@ class DialogManager {
let dialogId = this.playerDialogs_[playerId];
if (this.dialogs_.hasOwnProperty(dialogId)) {
- // Reject the promise with a PlayerDisconnectError.
- this.dialogs_[dialogId].reject(new PlayerDisconnectError);
-
+ this.dialogs_[dialogId].resolve(null);
delete this.dialogs_[dialogId];
}

0 comments on commit 5422013

Please sign in to comment.