Some notational convenience for formatting strings
We can now write
  throw Error("file '%s' not found", path);
instead of
  throw Error(format("file '%s' not found") % path);
and similarly
  printError("file '%s' not found", path);
instead of
  printMsg(lvlError, format("file '%s' not found") % path);
			
			
This commit is contained in:
		
							parent
							
								
									3f8e620b19
								
							
						
					
					
						commit
						4036185cb4
					
				
					 6 changed files with 81 additions and 22 deletions
				
			
		|  | @ -31,13 +31,6 @@ extern char * * environ; | |||
| namespace nix { | ||||
| 
 | ||||
| 
 | ||||
| BaseError::BaseError(const FormatOrString & fs, unsigned int status) | ||||
|     : status(status) | ||||
| { | ||||
|     err = fs.s; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| BaseError & BaseError::addPrefix(const FormatOrString & fs) | ||||
| { | ||||
|     prefix_ = fs.s + prefix_; | ||||
|  | @ -45,10 +38,10 @@ BaseError & BaseError::addPrefix(const FormatOrString & fs) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| SysError::SysError(const FormatOrString & fs) | ||||
|     : Error(format("%1%: %2%") % fs.s % strerror(errno)) | ||||
|     , errNo(errno) | ||||
| std::string SysError::addErrno(const std::string & s) | ||||
| { | ||||
|     errNo = errno; | ||||
|     return s + ": " + strerror(errNo); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue