Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for invalid config files #1159

Merged
merged 2 commits into from
Sep 4, 2018

Conversation

dpino
Copy link
Member

@dpino dpino commented Jul 25, 2018

Fixes #1020

@dpino
Copy link
Member Author

dpino commented Jul 25, 2018

Example:

$ sudo ./snabb lwaftr run --name lwaftr --cpu 10 --conf lwaftr-64k.conf --on-a-stick 82:00.0
lwaftr-64k.conf: loading compiled configuration from lwaftr-64k.o
lwaftr-64k.conf: compiled configuration is out of date; recompiling.
lwaftr-64k.conf: loading source configuration
      queue1 {
            ^
lwaftr-64k.conf:64049:12: error: unrecognized parameter: queue1

@wingo
Copy link

wingo commented Sep 3, 2018

The file name is available as stream.io.filename, so no need to plumb around. Probably we should add a method on stream to return it. WDYT?

@dpino
Copy link
Member Author

dpino commented Sep 4, 2018

OK, I amended the patches to add a stream:filename()' method and use it from Parser, instead of passing filename` around.

Copy link

@wingo wingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one nit

@@ -434,6 +434,8 @@ function Stream:write(...)
for _, arg in ipairs({ ... }) do write1(self, arg) end
end

function Stream:filename() return self.io.filename end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment above the function indicating that the result may be nil.

@dpino dpino merged commit 8fc37b5 into Igalia:lwaftr Sep 4, 2018
@dpino dpino deleted the fix-issue-1020 branch September 4, 2018 11:23
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.

2 participants