Error handling only needs last error.
This commit is contained in:
		@@ -19,15 +19,14 @@
 | 
			
		||||
#include "neocomm.h"
 | 
			
		||||
#include "error.hpp"
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
static std::vector<std::string> errors;
 | 
			
		||||
static std::string last_error;
 | 
			
		||||
 | 
			
		||||
void add_error(const std::string &error) {
 | 
			
		||||
	if(not errors.empty())
 | 
			
		||||
		errors.push_back(error);
 | 
			
		||||
	last_error = error;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *NeoComm_get_last_error() {
 | 
			
		||||
	return errors.back().c_str();
 | 
			
		||||
	return last_error.c_str();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user