|
|
|
|
|
by jameshart
1206 days ago
|
|
When you’re building a ‘parser’ (in this broad, type-narrowing sense) to handle user-supplied data, the result type really needs to be a rich mix of - successfully parsed data objects - error objects - warning objects That way your consumers can themselves decide what to do in the face of errors and warnings. (Of course one ugly old fashioned way to add optional ‘error’ types to your return signature is checked exceptions, but we don’t talk about that model any more.) |
|