Update README and ssp.hpp

This commit is contained in:
ado 2023-08-06 20:02:08 +02:00
parent 7df96d95c7
commit b913344722
2 changed files with 9 additions and 7 deletions

View File

@ -451,10 +451,13 @@ The **`eof`** method can be used to detect if the end of the file was reached.
Detailed error messages can be accessed via the **`error_msg`** method, and to enable them **`ss::string_error`** needs to be included in the setup. If **`ss::string_error`** is not defined, the **`error_msg`** method will not be defined either. Detailed error messages can be accessed via the **`error_msg`** method, and to enable them **`ss::string_error`** needs to be included in the setup. If **`ss::string_error`** is not defined, the **`error_msg`** method will not be defined either.
The line number can be fetched using the **`line`** method.
```cpp ```cpp
const std::string& parser::error_msg(); const std::string& parser::error_msg();
bool parser::valid(); bool parser::valid();
bool parser::eof(); bool parser::eof();
size_t parser::line();
// ... // ...
ss::parser<ss::string_error> parser; ss::parser<ss::string_error> parser;

13
ssp.hpp
View File

@ -2495,7 +2495,7 @@ public:
reader_.next_line_converter_.set_column_mapping(column_mappings, reader_.next_line_converter_.set_column_mapping(column_mappings,
header_.size()); header_.size());
if (line() == 0) { if (line() == 1) {
ignore_next(); ignore_next();
} }
} }
@ -2924,12 +2924,11 @@ private:
void decorate_rethrow(const ss::exception& e) const { void decorate_rethrow(const ss::exception& e) const {
static_assert(throw_on_error, static_assert(throw_on_error,
"throw_on_error needs to be enabled to use this method"); "throw_on_error needs to be enabled to use this method");
throw ss::exception{ throw ss::exception{std::string{file_name_}
std::string{file_name_} .append(" ")
.append(" ") .append(std::to_string(line()))
.append(std::to_string(line())) .append(": ")
.append(": ") .append(e.what())};
.append(e.what())};
} }
//////////////// ////////////////