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

Handle csv parsing error when encountering rows with different lengths #609

Merged
merged 1 commit into from Feb 16, 2019

Conversation

mziter
Copy link

@mziter mziter commented Feb 4, 2019

Current code is calling unwrap on each row that results from csv crate parsing logic. This has been changed to match and map an error result into the expected Teraform error with chaining. Associated unit test has been added.

@kellpossible
Copy link
Contributor

looks good!

@mziter mziter changed the title Handle csv parsing error to fix issue getzola/zola#588 Handle csv parsing error when encountering rows with different lengths Feb 5, 2019
e,
));
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

you want to use zola errors, not tera ;)

I believe you can replace this line by

let record = result..map_err(|e| Error::chain("Error encountered when parsing csv records", e))?;

Copy link
Author

Choose a reason for hiding this comment

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

Sure, sorry about the oversight. I'll take a look soon and update PR.

Copy link
Collaborator

@Keats Keats Feb 9, 2019

Choose a reason for hiding this comment

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

Sorry actually, I just realised this is a Tera function so using the Tera error makes sense/is required!

@Keats Keats merged commit 42089a1 into getzola:next Feb 16, 2019
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.

None yet

3 participants