Skip to content

Improve error messages with custom serde deserialisation functions #1491

Description

@AdrianDAlessandro

The lack of clarity in the error output is consistent with other times this custom deserialisation is used in the code.

One thing worth noting, is that when it is used with a toml input file, the error message is quite clear. For example

[16:53:05 ERROR muse2] Failed to load model.

Caused by:
    0: Error reading /private/var/folders/td/5nhj1569101bqjj_vmltr_7r0000gp/T/.tmpaxxQee/circularity/model.toml
    1: TOML parse error at line 2, column 19
         |
       2 | capacity_margin = -0.3
         |                   ^^^^
       Value must be a finite number greater than or equal to zero

But it's less clear with CSV input files

[16:53:19 ERROR muse2] Failed to load model.

Caused by:
    0: Error reading /private/var/folders/td/5nhj1569101bqjj_vmltr_7r0000gp/T/.tmpzLMuo8/circularity/agent_commodity_portions.csv
    1: CSV deserialize error: record 11 (line: 12, byte: 246): Value must be > 0 and <= 1

Originally posted by @AdrianDAlessandro in #1485 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions