← Back to team overview

nrtb-core team mailing list archive

[Bug 725107] [NEW] Todo: (style) exception usage seems overly complex.

 

Public bug reported:

In dbAccess.cpp, line 81 of revision 36 we find the following:

	default:
					throw bad_type("dbAccess::sqlExecute - Invalid query type used,");
					break;
	}

Assuming the dbAccess::bad_type is only thrown in this context (a bad
query type passed to dbAccess::sqlExecute()) it would be better if the
exception name is changed to dbAccess::unknown_query_type. This would
allow you construct and throw without loading a string (faster) and
makes picking the exception off by type name in catch statements more
clear.  The new code would be something like this:

default:
               {
                   throw unknown_query_type();
               };

};

** Affects: nrtb
     Importance: Medium
     Assignee: George Jordan (gsjordanc)
         Status: New

-- 
You received this bug notification because you are a member of NRTB
Core, which is subscribed to New Real Time Battle.
https://bugs.launchpad.net/bugs/725107

Title:
  Todo: (style) exception usage seems overly complex.

Status in The New Real Time Battle Project:
  New

Bug description:
  In dbAccess.cpp, line 81 of revision 36 we find the following:

  	default:
  					throw bad_type("dbAccess::sqlExecute - Invalid query type used,");
  					break;
  	}

  Assuming the dbAccess::bad_type is only thrown in this context (a bad
  query type passed to dbAccess::sqlExecute()) it would be better if the
  exception name is changed to dbAccess::unknown_query_type. This would
  allow you construct and throw without loading a string (faster) and
  makes picking the exception off by type name in catch statements more
  clear.  The new code would be something like this:

  default:
                 {
                     throw unknown_query_type();
                 };

  };



Follow ups

References