Bug / Feature #1988
closed
  
    
    
  
Wrong Exception-Message in "TSerializable Load<TSerializable>(string fileName)"
 
        
        Added by LukyLuke almost 14 years ago.
        Updated over 12 years ago.
        
Start date:
15 November 2011
 
Request Type:
Feature Request
 
 
  
  
  
  Description
  
  File: pi-vote/Common/Serialization/Serializable.cs
Function: public static TSerializable Load<TSerializable>(string fileName)
Note: This function is templated, so it should throw a customized Exception and not only a "Certificate file not found" :)
public static TSerializable Load<TSerializable>(string fileName)
  where TSerializable : Serializable
{
  if (fileName == null)
    throw new ArgumentNullException("fileName");
  if (!File.Exists(fileName))
    throw new ArgumentException("Certificate file not found.");
  return Serializable.FromBinary<TSerializable>(File.ReadAllBytes(fileName));
}
   
 
 
  
  
    
    
    
    cool, jemand der sich den source ansieht. aber bleib mit bitte mit templates vom leib! der mechanismus heisst 'generics' ;)
 
     
   
  
  
    
    
    
    template <typename T>
class Response
{
public:
  Response(T answer) { std::cout << answer << std::endl; };
};
Response<std::string> resp(" 
Mache ich gerne, wie schon mal gesagt ;) 
Und dabei habe ich schon das ein oder andere lustige Konstrukt und if-Treppchen gefunden.
Aber über Eleganz und Schönheit beim Coden lässt sich ja wunderbar streiten :) 
Einen C++ und Qt Parser/Deserializer für die Zertifikate habe ich schon nachgebaut - nur noch nicht als Factory
");
 
     
   
  
  
    
    
    
    
       - Tracker changed from 2 to Bug / Feature
 
       - Status changed from New to Needs Work
 
    
    
     
   
  
  
    
    
    
    
       - Category set to Usability
 
       - Target version changed from Backlog to PiVote 1.3.2.0
 
       - Request Type set to Feature Request
 
       - Affected Program set to All
 
       - Affected Users set to All
 
    
    
     
   
  
  
    
    
    
    
       - Status changed from Needs Work to Done
 
       - % Done changed from 0 to 100
 
    
    
     
   
  
  
    
    
    
    
       - Assignee changed from Exception to LukyLuke
 
    
    Automaticaclly enforce assigned-to to the author of the ticket
 
     
   
  
  
    
    
    
    
       - Due date set to 12 March 2013
 
    
    Automatically enforce due date for Low Priority after 60 days in the future
 
     
   
  
  
    
    
    
    
       - Status changed from Done to Closed
 
    
    
     
   
  
 
  
  
 
Also available in:  Atom
  PDF