2
\$\begingroup\$

I've seen games crash and throw errors. Usually games don't throw raw exception message, but codename error names, such as F204 or similar. I would like to know some thought about that.

Also, as i understand they separate errors in non critical on which maybe some message is shown and there are critical on which game is shut down and error window pops up.

Example, this is how i see it

//Some actions
try{
    Bone bone = character.bones.Get(5);
}catch(ArgumentOutOfRangeException e){

    //show error - stack trace, message, or code name error
    ExceptionHandler(e.ToString(), ErrorType.CRITICAL); //handles

    //also could be, or similar
    ExceptionHandler("V401", ErrorType.CRITICAL); //handles, this is shown in game
}

public Bone Get(int index){
    if (index < 0 || index >= _someData.Length) throw new ArgumentOutOfRangeException("Index is out of range.");
    return _someData[index];
}

I think product users should not really see any exception logs but rather code names. But what are the suggested management for this - error string manual pass like it did (but i don't think its manageable), constant in separate class, enums?

Edit: Of course, having an error codename catalog would make the life easier for the devs themselves. If user submits an error, they can find the spot quite quickly. Does this made any sense?

Thanks

\$\endgroup\$

closed as off-topic by Josh Jul 2 '15 at 1:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions that aren't specific to game development are off-topic here, but can be asked on Stack Overflow. A good rule of thumb is to ask yourself "would a professional game developer give me a better/different/more specific answer to this question than other programmers?"" – Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ -1 Your question is unclear. \$\endgroup\$ – Alexandre Vaillancourt Jul 1 '15 at 23:25
  • 1
    \$\begingroup\$ Which part? What are good practices to handle, show to client and manage exceptions - errors. For games. \$\endgroup\$ – YoungDeveloper Jul 1 '15 at 23:58
  • 1
    \$\begingroup\$ I debate that this is off topic. Game error reporting is much different than standard software error reporting. An answer: pc and console games by and large don't use exception handling, because they slow down execution. Often though, asserts are used in non release builds to help catch problems during development. Enums / defines are common ways of specifying error codes in the code. These codes are sometimes used by customer service to help the user diagnose problems, also as you say, they can map to localized strings. Codes don't give hints as to how the code works internally either. \$\endgroup\$ – Alan Wolfe Jul 2 '15 at 1:55
  • 1
    \$\begingroup\$ Games aren't the only thing that tend not use exceptions, it's a broadly-debated subject. Speaking of which, on-topicness aside, there's still no concrete question here that isn't asking for a discussion. This is probably better asked on GDNet. \$\endgroup\$ – Josh Jul 2 '15 at 4:45
  • \$\begingroup\$ "Game error reporting is much different than standard software error reporting." But the again @JoshPetrie describes question as "would a professional game developer give me a better/different/more specific answer to this question than other programmers?" If game development error handling is different, then it makes sense that professional game developer would give a better answer. While games tend not to use exceptions I can think of several examples where it should be a must. Couple months ago i wrote an authoritative server and client API - which might throw exception from sockets. \$\endgroup\$ – YoungDeveloper Jul 2 '15 at 10:11