Skip to content

better no value found errors #87

@tanner0101

Description

@tanner0101

Feature request for Node 3.0.

It would be very nice if node errors included their keys. This will probably take some work to implement since we will need to pass the keys around to different node objects as we recurse. We can probably look into how Encodable/Decodable do it with the keyed container API.

Example of current non-helpful errors:

[Node Error: No value found at path '', expected 'String'] [Identifier: Node.NodeError.unableToConvert] [Possible Causes: typo in key path, underlying type is not convertible, unexpected '.' being interpreted as path instead of key] [Suggested Fixes: called `get(...)` on a key or key path that does not exist in the data, the data being parsed is missing required values or is incorrectly formatted, found unconvertible data, e.g., got a string of letters when an integer is required, if you have keys containing a '.' that shouldn't be interpreted as a path, use 'DotKey("actual.key")']

For code:

hosting.gitURL = try req.data.get("gitURL")

This should say something like "no value found at path gitURL". Would be even better if it suggested some possible fixes (for example there was only one other key in the dictionary, named "gitUrl", etc).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions