fix: cbor write of errorsets
This commit is contained in:
parent
016e597df3
commit
c220c79e97
1 changed files with 6 additions and 1 deletions
|
@ -152,7 +152,12 @@ fn writeNull(writer: anytype) @TypeOf(writer).Error!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn writeErrorset(writer: anytype, err: anyerror) @TypeOf(writer).Error!void {
|
fn writeErrorset(writer: anytype, err: anyerror) @TypeOf(writer).Error!void {
|
||||||
try writer.print("error.{s}", .{@errorName(err)});
|
var buf: [local_heap_size]u8 = undefined;
|
||||||
|
var stream = fixedBufferStream(&buf);
|
||||||
|
const writer_ = stream.writer();
|
||||||
|
_ = writer_.write("error.") catch @panic("cbor.writeErrorset failed!");
|
||||||
|
_ = writer_.write(@errorName(err)) catch @panic("cbor.writeErrorset failed!");
|
||||||
|
return writeString(writer, stream.getWritten());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
|
pub fn writeValue(writer: anytype, value: anytype) @TypeOf(writer).Error!void {
|
||||||
|
|
Loading…
Add table
Reference in a new issue