Error handling only needs last error.

This commit is contained in:
Nicolás Ortega Froysa 2017-09-25 15:59:23 +02:00
parent c188630590
commit a827b11d86
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF

View File

@ -19,15 +19,14 @@
#include "neocomm.h" #include "neocomm.h"
#include "error.hpp" #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) { void add_error(const std::string &error) {
if(not errors.empty()) last_error = error;
errors.push_back(error);
} }
const char *NeoComm_get_last_error() { const char *NeoComm_get_last_error() {
return errors.back().c_str(); return last_error.c_str();
} }