Skip to content

Commit

Permalink
fix(checks): latest does not check for nil (#147)
Browse files Browse the repository at this point in the history
Maybe is a smell that we need `Struct.tryFromJson` but the core issue is the undefined object passed validation, which is surprising to me, but non the less there is some cleanup needed in Struct.fromJson since I made the changes to only return back the fields that match, and not the whole object.
  • Loading branch information
hasanaburayyan authored Mar 25, 2024
1 parent 9a301cc commit f905dcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion checks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/checks",
"version": "0.0.8",
"version": "0.0.9",
"description": "Cloud checks",
"publishConfig": {
"access": "public",
Expand Down
5 changes: 4 additions & 1 deletion checks/results.w
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ pub class Results {
pub inflight latest(checkid: str): CheckResult? {
let key = this.makeLatestKey(checkid);
let s = this.bucket.tryGetJson(key);
return CheckResult.fromJson(s);
if let s = s {
return CheckResult.fromJson(s);
}
return nil;
}

inflight makeKey(checkid: str, key: str): str {
Expand Down

0 comments on commit f905dcb

Please sign in to comment.