Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2017-01-02 18:18:34

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

How do I prevent PlayerIO from throwing costly exceptions?

When one throws; an exception, it is resource costly.
I wish to prevent this by checking all parameters when logging into a PlayerIO server, e.g. the GameID exists, the username and password exists, the facebook/kongregate account exists, the credentials are right, e.t.c e.t.c before finally logging in.
By checking all of these I hope to prevent an exception BEFORE it happens, and also have a more detailed report to the user on why their specified login failed.

Is there a way to prevent this, or do I have to deal with PlayerIO's costly exception throwing and basic error messages?

@Atilla: ok mr.pie if ur gonna argue about how "modern pc can handle throw; u idiot" pls leave tyvm

Offline

#2 2017-01-02 18:22:41, last edited by drunkbnu (2017-01-02 18:25:18)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

public static Client cli;
public static Connection con;
public static void Connect (string email, string password, string world) {
  try {
    cli = PlayerIO.QuickConnect.SimpleConnect ("everybody-edits-su9rn58o40itdbnw69plyw", email, password, null);
    con = cli.Multiplayer.JoinRoom (world, null);
    con.Send ("init");
    con.OnMessage += delegate (object sender, Message e) { // ... };
    con.OnDisconnect += delegate (object sender, string reason) { // ... };
  } catch (Exception error) {
    Console.WriteLine (error.Message);
    Console.ReadKey (true);
  }
}

That's what exceptions are for. To tell you what went wrong.

Offline

Wooted by: (3)

#3 2017-01-02 18:25:33

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: How do I prevent PlayerIO from throwing costly exceptions?

can I say the (seeming truth) that you don't want to hear from atilla?

You're talking about potentially a once or twice issue for each user. I feel like what PlayerIO passes in the error message is already pretty verbose.

I guess I don't see the issue adding up. Sidenote: what if you were looping an exception? Does that become a place where you'd want to avoid an exception? Say thousands or millions of tests... hopefully you aren't doing that with the login eh

Offline

Wooted by:

#4 2017-01-02 18:29:40

SmittyW
Member
Joined: 2015-03-13
Posts: 2,085

Re: How do I prevent PlayerIO from throwing costly exceptions?

So you want to avoid an exception by throwing your own exception? What?

Offline

Wooted by: (2)

#5 2017-01-02 18:30:19, last edited by Swarth100 (2017-01-02 18:33:11)

Swarth100
Member
Joined: 2015-07-18
Posts: 305

Re: How do I prevent PlayerIO from throwing costly exceptions?

hummerz5 wrote:

can I say the (seeming truth) that you don't want to hear from atilla?

^This just killed me

SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

It might make sense when working with bad libraries,

Say you get a LoginFailedException, and instead would love to have a more detailed InvalidUsernameException.

(I personaly do not know what exceptions PlayerIO throws in these cases)

Offline

#6 2017-01-02 18:30:28

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

NinjaException

Offline

Wooted by: (4)

#7 2017-01-02 18:32:52, last edited by SirJosh3917 (2017-01-02 18:36:32)

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: How do I prevent PlayerIO from throwing costly exceptions?

Hopefully the open source PlayerIO can fix this.

hummerz5 wrote:

can I say the (seeming truth) that you don't want to hear from atilla?

Yes and no
Because of this http://forums.everybodyedits.com/viewtopic.php?id=37703
Atilla's only argument was "nubs celebrate new year at UTC" of which Atilla clearly doesn't understand religion and symbolic things because they're too scientific.

An entire argument was formed upon "celebrate new year at UTC" when the other argument was "its symbolic bro"

I'd be glad to bring in atilla upon this subject however, as Atilla is one of the develoipers in OPIO and is handling how to check for these sorts of things.

EDIT: wow why have you guys turned this topic into this

SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

Quote where I said I'd like to throw my own exception.

Offline

#8 2017-01-02 18:36:07, last edited by drunkbnu (2017-01-02 18:38:07)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK because that's what exceptions are for, and learn how to handle them by using try/catch.

ninjasupeatsninja wrote:

I wish to prevent this by checking all parameters when logging into a PlayerIO server, e.g. the GameID exists, the username and password exists, the facebook/kongregate account exists, the credentials are right, e.t.c e.t.c before finally logging in.

That's exactly what the SDK does for you. If it fails, it'll throw you an Exception telling you what gone wrong (wrong credentials, internet problems, etc.).

Offline

#9 2017-01-02 18:37:21

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: How do I prevent PlayerIO from throwing costly exceptions?

HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

Offline

#10 2017-01-02 18:39:59, last edited by drunkbnu (2017-01-02 18:43:31)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

ninjasupeatsninja wrote:
HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

To check where what and when what? It'll throw the exception when executing the code fails, like any other Exception thrown. If you don't want to handle it, it's your fault.

Offline

#11 2017-01-02 18:43:30

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: How do I prevent PlayerIO from throwing costly exceptions?

HG wrote:
ninjasupeatsninja wrote:
HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

To check where what and when what? It'll throw the exception when executing the code fails, like any other Exception thrown.

You're clearly not understanding the point of this topic and discussion.
I want to be able to check all various kinds of things before logging in to avoid throwing or catching a costly exception.
I wish to be able to check for everything first to make sure that the exception won't be thrown.

If you have a problem with the fact that I do not wish for an exception to be thrown, please leave, as this wouldn't add any current discussion to the topic, and it'd be two idiots fighting over an opinion of what they both prefer to do and how one is better than the other, when they're clearly both opinions.

Offline

#12 2017-01-02 18:46:26

Swarth100
Member
Joined: 2015-07-18
Posts: 305

Re: How do I prevent PlayerIO from throwing costly exceptions?

ninjasupeatsninja wrote:
HG wrote:
ninjasupeatsninja wrote:
HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

To check where what and when what? It'll throw the exception when executing the code fails, like any other Exception thrown.

You're clearly not understanding the point of this topic and discussion.
I want to be able to check all various kinds of things before logging in to avoid throwing or catching a costly exception.
I wish to be able to check for everything first to make sure that the exception won't be thrown.

If you have a problem with the fact that I do not wish for an exception to be thrown, please leave, as this wouldn't add any current discussion to the topic, and it'd be two idiots fighting over an opinion of what they both prefer to do and how one is better than the other, when they're clearly both opinions.

I believe you guys both have a point,

From my experience you would usually want to have an exceptions thrown, and, if necessary, once you catch it understand what went wrong.

Offline

#13 2017-01-02 18:46:30, last edited by drunkbnu (2017-01-02 18:48:23)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

ninjasupeatsninja wrote:
HG wrote:
ninjasupeatsninja wrote:
HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

To check where what and when what? It'll throw the exception when executing the code fails, like any other Exception thrown.

You're clearly not understanding the point of this topic and discussion.
I want to be able to check all various kinds of things before logging in to avoid throwing or catching a costly exception.
I wish to be able to check for everything first to make sure that the exception won't be thrown.

If you have a problem with the fact that I do not wish for an exception to be thrown, please leave, as this wouldn't add any current discussion to the topic, and it'd be two idiots fighting over an opinion of what they both prefer to do and how one is better than the other, when they're clearly both opinions.

And what are you supposed to do when checking the variables? If a parameter is not correct you'll end getting an Exception anyways.

Who would want to connect to the Player.IO server and check the entire account database to check if the credentials are correct just to prevent any kind of Exceptions you'll end getting because the SDK will throw them to you.

If you want to completely avoid Exceptions, you should not use PlayerIOClient and create your own SDK for that.

What's wrong with Exceptions anyway? You're trying to hide what went wrong to the user to tell him what gone wrong which is exactly what gone wrong when the Exception was thrown.

Offline

#14 2017-01-02 18:48:21

SmittyW
Member
Joined: 2015-03-13
Posts: 2,085

Re: How do I prevent PlayerIO from throwing costly exceptions?

ninjasupeatsninja wrote:
SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

Quote where I said I'd like to throw my own exception.

You said you wanted to avoid a PlayerIO exception and "also have a more detailed report to the user on why their specified login failed" aka throwing your own exception, right? How can you check if an account is valid without some message telling you it is or isn't?

Offline

#15 2017-01-02 18:49:59

Swarth100
Member
Joined: 2015-07-18
Posts: 305

Re: How do I prevent PlayerIO from throwing costly exceptions?

HG wrote:
ninjasupeatsninja wrote:
HG wrote:
ninjasupeatsninja wrote:
HG wrote:

You should go learn what an Exception is, know that OpenPIO will throw exceptions the same as PlayerIOClient and any other decent SDK, and learn how to handle them.

Of course OPIO will throw exceptions, but it will have the code to check where and when to throw the exception.

To check where what and when what? It'll throw the exception when executing the code fails, like any other Exception thrown.

You're clearly not understanding the point of this topic and discussion.
I want to be able to check all various kinds of things before logging in to avoid throwing or catching a costly exception.
I wish to be able to check for everything first to make sure that the exception won't be thrown.

If you have a problem with the fact that I do not wish for an exception to be thrown, please leave, as this wouldn't add any current discussion to the topic, and it'd be two idiots fighting over an opinion of what they both prefer to do and how one is better than the other, when they're clearly both opinions.

And what are you supposed to do when checking the variables? If a parameter is not correct you'll end getting an Exception anyways.

Who would want to connect to the Player.IO server and check the entire account database to check if the credentials are correct just to prevent any kind of Exceptions you'll end getting because the SDK will throw them to you.

If you want to completely avoid Exceptions, you should not use PlayerIOClient and create your own SDK for that.

What's wrong with Exceptions anyway? You're trying to hide what went wrong to the user to tell him what gone wrong which is exactly what gone wrong when the Exception was thrown.

^1000th post btw

Offline

#16 2017-01-02 18:51:24, last edited by drunkbnu (2017-01-02 18:57:22)

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

SmittyW wrote:
ninjasupeatsninja wrote:
SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

Quote where I said I'd like to throw my own exception.

You said you wanted to avoid a PlayerIO exception and "also have a more detailed report to the user on why their specified login failed" aka throwing your own exception, right? How can you check if an account is valid without some message telling you it is or isn't?

It is possible to use if-else for comparing the parameters with the server parameters (which would require a lot of hard and completely useless work), but what are you supposed to do at the else part to tell the user what gone wrong without throwing an Exception which contains the detailed information?

It's like creating an Exception for each type of error you can get at the moment of logging in. (InvalidUsernameException, InvalidPasswordException, NoRoomRunningException)

Now, an Exception is a class. Of course we could have returned a string. But how are you supposed to check it then?

Offline

#17 2017-01-02 18:57:38

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: How do I prevent PlayerIO from throwing costly exceptions?

HG wrote:

It is possible to use if-else for comparing the parameters with the server parameters, but what are you supposed to do at the else part to tell the user what gone wrong without throwing an Exception?

Pretty sure it breaks down like this.

The sdk does whatever prerequisite testing it wants to, including whatever can go wrong with the login attempt. So naturally you make sure the game exists, the email exists, and that the password matches the email. If any of this fails, it's not going to just return null, it'll throw the exception.

Ninja wants to do the prerequisite testing we mentioned previously. If he does that, he no longer needs to throw an exception. He could, if what he is seeking exists, simply replace the pseudocode "throw exception" lines with "console writeline" lines, if he thinks there's some way he could be more specific.

Yes?

HG wrote:

Now, an Exception is a class. Of course we could have returned a string. But how are you supposed to check it then?

Don't they already specify what the problem is via an inner message? Why the extra exceptions?

Offline

Wooted by:

#18 2017-01-02 18:57:45, last edited by SirJosh3917 (2017-01-02 19:02:18)

SirJosh3917
Formerly ninjasupeatsninja
From: USA
Joined: 2015-04-05
Posts: 2,095

Re: How do I prevent PlayerIO from throwing costly exceptions?

Swarth100 wrote:

I believe you guys both have a point,

From my experience you would usually want to have an exceptions thrown, and, if necessary, once you catch it understand what went wrong.

However, I'd like to check that everything wouldn't be wrong first, to ensure that no exception gets thrown. I'd like to understand the error first before the exception gets thrown, as this would hopefully make a faster login process by informing the user of something incorrect before they login.

HG wrote:

And what are you supposed to do when checking the variables? If a parameter is not correct you'll end getting an Exception anyways.

You won't get an exception if you check it before it happens.

HG wrote:

Who would want to connect to the Player.IO server and check the entire account database to check if the credentials are correct just to prevent any kind of Exceptions you'll end getting because the SDK will throw them to you.

This is perhaps a very dumb thing to say - clearly I want to based on the current argument

HG wrote:

If you want to completely avoid Exceptions, you should not use PlayerIOClient and create your own SDK for that.

Which is why I need to learn how PlayerIOClient works so I can make my own native C++ SDK and incorporate that in a native C++ console application and then we have the most crossplatform bot in the world EE! Brilliant! Add in QT and now it's the most crossplatform GUI bot!

What's wrong with Exceptions anyway?

Me being a low-memory-performance-at-all-costs-save-all-the-memory-memory-lives-matter
Although I don't even know the performance penalties.

Also I hope to achieve faster login by checking everything first.

EDIT:

SmittyW wrote:
ninjasupeatsninja wrote:
SmittyW wrote:

So you want to avoid an exception by throwing your own exception? What?

Quote where I said I'd like to throw my own exception.

You said you wanted to avoid a PlayerIO exception and "also have a more detailed report to the user on why their specified login failed" aka throwing your own exception, right? How can you check if an account is valid without some message telling you it is or isn't?

MessageBox.Show("hey nub ur acc email is bad");

EDIT2:
Closing the topic because I see that my argument is clumsy and nobody is answering the original question.

Offline

#19 2017-01-02 19:01:54

hummerz5
Member
From: wait I'm not a secret mod huh
Joined: 2015-08-10
Posts: 5,853

Re: How do I prevent PlayerIO from throwing costly exceptions?

Here's a thought. What if the client doesn't break these into a bunch of different checks? What if the call is neatly packaged and sent off to the server as a whole? In that case, there's nothing you can do

If this is wrong, then you won't really gain much. I'm thinking about the individual requests sent off on down the line. Surely your computer can resolve an exception in fractions of the time it takes the round-trip.

also didn't someone tell you the last time you wanted to optimize that .NET is not very small to begin with? You'd be shrinking your portion of an otherwise large setup

Offline

#20 2017-01-02 19:02:09

SmittyW
Member
Joined: 2015-03-13
Posts: 2,085

Re: How do I prevent PlayerIO from throwing costly exceptions?

ninjasupeatsninja wrote:

Although I don't even know the performance penalties.
Also I hope to achieve faster login by checking everything first.

Okay I think we're done here. Wrap it up guys

Offline

#21 2017-01-02 19:02:26

drunkbnu
Formerly HG
Joined: 2017-08-16
Posts: 2,306

Re: How do I prevent PlayerIO from throwing costly exceptions?

By checking all the variables before logging in, you will just get a slower, slower log in.

Now, if a parameter is not correct, what do you think you will get that tells you that the parameters was wrong, apart from an Exception? Which error are you trying to understand if you have no Exception that tells you what gone wrong?

Offline

Wooted by:
drunkbnu1483380146641645

Board footer

Powered by FluxBB

[ Started around 1732727421.8681 - Generated in 0.136 seconds, 12 queries executed - Memory usage: 1.81 MiB (Peak: 2.08 MiB) ]