pub enum JobError {
Show 18 variants
Read(Error),
Write {
table: usize,
source: Error,
},
Yson {
offset: u64,
source: YsonError,
},
TruncatedRecord {
offset: u64,
buffered: usize,
},
RecordTooLarge {
offset: u64,
limit: usize,
},
BadControlRecord {
offset: u64,
reason: String,
},
Skiff(CodecError),
BadSkiffSchema {
table: usize,
reason: String,
},
BadSkiffControl {
table: usize,
column: &'static str,
reason: String,
},
SkiffOutputSchemaCount {
sinks: usize,
schemas: usize,
},
SkiffWrite {
table: usize,
source: CodecError,
},
UnsupportedDataFormat,
WorkerRowFormatMismatch {
writer: &'static str,
row: &'static str,
},
UnknownTable {
index: usize,
count: usize,
names: Vec<String>,
},
Serialize {
table: usize,
source: YsonError,
},
TooManyStatistics {
limit: usize,
name: String,
},
Statistics {
reason: String,
},
WriteAfterFinish {
table: usize,
},
}Expand description
Something went wrong reading input or writing output.
Every variant is fatal to the job. YTsaurus judges a job by its exit code,
so the right response is to report the error on stderr — where the operation
UI shows it — and exit non-zero. crate::run does that for you.
Variants§
Read(Error)
Reading the input stream failed.
Write
Writing to an output table failed.
Treated as fatal: a partial write means the output table would be missing rows, and silently producing a truncated table is worse than failing the job.
Yson
The input was not valid YSON.
Fields
TruncatedRecord
The stream ended part-way through a record.
Fields
RecordTooLarge
A single record was larger than the reader is willing to buffer.
Because a record must be contiguous in memory to be parsed, an
implausibly large length prefix in corrupt input would otherwise be an
out-of-memory abort. See crate::JobReader::with_max_record_bytes.
Fields
BadControlRecord
A control record carried an attribute value of the wrong type.
Fields
Skiff(CodecError)
The Skiff stream could not be framed or decoded.
BadSkiffSchema
The operation’s Skiff schema put system fields in an invalid layout.
Fields
BadSkiffControl
A Skiff system field carried a value that does not have its prescribed shape.
Fields
SkiffOutputSchemaCount
The number of Skiff output descriptors did not match the format’s table schemas.
Fields
SkiffWrite
Writing or flushing a Skiff output table failed.
Fields
source: CodecErrorThe framing, validation, or I/O failure.
UnsupportedDataFormat
This version of the worker runtime does not know a future
ytsaurus_format::DataFormat variant yet.
WorkerRowFormatMismatch
A row’s representation did not match the writer’s selected format.
Fields
UnknownTable
A row was written to an output table the job does not have.
Fields
names: Vec<String>Declared table names, when the writer was built with
crate::JobWriter::named. Turns a bare index into something the
reader of the error can act on.
Serialize
Serializing a row failed.
Fields
TooManyStatistics
More custom statistics than a job is allowed to report.
The limit is on distinct names, not on writes: adding to one already recorded is always fine.
Statistics
Sending custom statistics failed.
Separate from JobError::Write because descriptor 5 is not an output
table, and reporting it as “output table 5” would send the reader
looking for a table that does not exist.
WriteAfterFinish
A row was written after crate::JobWriter::finish.
finish is the writer’s end: a row accepted after it would sit in the
buffer and vanish when the job exits — a short table under exit code
zero, the exact outcome finish exists to rule out. Refusing the row
makes the bug the caller’s to see instead of the table’s to carry.
Implementations§
Source§impl JobError
impl JobError
Sourcepub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
A short, stable name for what went wrong.
Formatting a JobError allocates and produces a message that may change
between versions. A job that quarantines bad rows wants neither: it wants
a cheap, stable value to put in a reason column so the rejects table
can be grouped and counted.
// Cheap and stable — safe to write into an output table.
let reason: &'static str = e.kind();Sourcepub fn is_row_local(&self) -> bool
pub fn is_row_local(&self) -> bool
Whether this error is about one bad row rather than the stream itself.
A job that quarantines bad rows should keep going for these and stop for the rest: a truncated stream or a failed write means every subsequent row is suspect, and carrying on would quietly produce a short output table.
if e.is_row_local() {
// quarantine the row and continue
} else {
return Err(e);
}Trait Implementations§
Source§impl Error for JobError
impl Error for JobError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()