Skip to content
Snippets Groups Projects
Select Git revision
  • 1d8edb214b1d3bd9f9be5613468dfd4792ae58d5
  • master default protected
  • fix-words-ann
  • wccl-rules-migration
  • develop
5 results

exception.cpp

Blame
  • user avatar
    Adam Wardynski authored
    a6435107
    History
    exception.cpp 1.07 KiB
    #include <libwccl/exception.h>
    #include <sstream>
    
    namespace Wccl {
    
    WcclError::WcclError(const std::string &what)
     : PwrNlp::PwrNlpError(what)
    {
    }
    
    WcclError::~WcclError() throw()
    {
    }
    
    std::string WcclError::scope() const
    {
    	return "Wccl";
    }
    
    FileNotFound::FileNotFound(const std::string& filename,
    		const std::string& paths, const std::string& where)
    	: WcclError("File not found: " + filename), filename(filename),
    	paths(paths), where(where)
    {
    }
    
    FileNotFound::~FileNotFound() throw()
    {
    }
    
    std::string FileNotFound::info() const
    {
    	std::ostringstream ss;
    	if (where.empty()) {
    		ss << "File ";
    	} else {
    		ss << where << " file ";
    	}
    	ss << "'" << filename << "' not found in search path " << paths;
    	return ss.str();
    }
    
    InvalidArgument::InvalidArgument(const std::string &arg_name, const std::string &reason)
    	: WcclError(reason),
    	  arg_name(arg_name),
    	  reason(reason)
    {
    }
    
    InvalidArgument::~InvalidArgument() throw()
    {
    }
    
    std::string InvalidArgument::info() const
    {
    	std::ostringstream ss;
    	ss << "Invalid argument " << arg_name << " : " << reason;
    	return ss.str();
    }
    
    } /* end ns Wccl */