Skip to content

Prevent modules from returning a nil result#79

Merged
zakird merged 2 commits into
mainfrom
phillip/78-module-err-behavior
May 6, 2026
Merged

Prevent modules from returning a nil result#79
zakird merged 2 commits into
mainfrom
phillip/78-module-err-behavior

Conversation

@phillip-stephens
Copy link
Copy Markdown
Contributor

@phillip-stephens phillip-stephens commented May 6, 2026

It's common when we run into an error when annotating to 1) log 2) return nil so that downstream parsers don't get a half-created result with no indication that something has gone wrong.

However, our modules were split between returning an empty result or nil, this PR adds a check in annotate.go so any nil results will be converted to an empty struct, thereby streamlining downstream processing:

Example:

echo "127.0.0.123" |  ./zannotate --censys --censys-pat="censys_xxxxXXXXXxxxxxx" --rdns --routing --routing-mrt-file=./data-snapshots/routing.mrt
{"ip":"127.0.0.123","censys":{},"rdns":{},"routing":{}}

Related Issues

Closes #78

@phillip-stephens phillip-stephens marked this pull request as ready for review May 6, 2026 02:39
@phillip-stephens phillip-stephens requested a review from zakird May 6, 2026 02:40
@zakird zakird merged commit 5b02ccb into main May 6, 2026
6 checks passed
@zakird zakird deleted the phillip/78-module-err-behavior branch May 6, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align modules on error behavior

2 participants