mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
add custom errors to encoding lib (#9513)
This commit is contained in:
parent
5c21c748c9
commit
ab6e0ed0b3
2 changed files with 26 additions and 13 deletions
|
@ -7,7 +7,7 @@ import strings
|
|||
|
||||
struct Writer {
|
||||
mut:
|
||||
sb strings.Builder
|
||||
sb strings.Builder
|
||||
pub mut:
|
||||
use_crlf bool
|
||||
delimiter byte
|
||||
|
@ -23,7 +23,7 @@ pub fn new_writer() &Writer {
|
|||
// write writes a single record
|
||||
pub fn (mut w Writer) write(record []string) ?bool {
|
||||
if !valid_delim(w.delimiter) {
|
||||
return err_invalid_delim
|
||||
return IError(&ErrInvalidDelimiter{})
|
||||
}
|
||||
le := if w.use_crlf { '\r\n' } else { '\n' }
|
||||
for n, field_ in record {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue