google / google/json_serializable.dart

Add breadcrumbs to CheckedFromJsonException

Open
#1,541 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.6k
Forks
461
Avg merge
45m
Merged PRs (30d)
1

Description

Good afternoon!
The suggestion is to add bread crumbs so that you can trace all the way to the problem area.

Such information would be useful for debugging or error detection.

```
"key_ one" => 1 => "key_ two" => 3
```

The number means which item is in the list

Suggestion: add field to CheckedFromJsonException:

```
final List parentStack;
````

Where StackTraceJson is (as an example):

```
class StackTraceJson {
const StackTraceJson.key(String this.key)
: index = null;
const StackTraceJson.index(int this.index)
: key = null;
// Params
final String? key;
final int? index;
// Localized
@override
String toString() => (key != null) ? '"$key"' : "$index";
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.