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

Add some band-aid to convert #2458

Closed
bep opened this issue Sep 16, 2016 · 4 comments
Closed

Add some band-aid to convert #2458

bep opened this issue Sep 16, 2016 · 4 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Sep 16, 2016

See #2439 #2441

The above needs proper solutions, but we got to postpone those.

A temporary hack would be to:

  1. Log and continue on error in convert
  2. Include panics in 1)
@bep bep added this to the v0.17 milestone Sep 16, 2016
@bep bep self-assigned this Sep 16, 2016
@moorereason
Copy link
Contributor

Can you isolate the conversions in wrapper functions to recover from panics?

func marshalYAML(v interface{}) (b []byte, err error) {
    defer func() {
        if r := recover(); r != nil {
            var ok bool
            err, ok = r.(error)
            if !ok {
                err = fmt.Errorf("pkg: %v", r)
            }
        }
    }()
    return yaml.Marshal(v)
}

@bep
Copy link
Member Author

bep commented Sep 16, 2016

The recover is implicit in 2) above. I know Go. I taught Steve Go. And now he is on the Go team :-)

@bep
Copy link
Member Author

bep commented Sep 16, 2016

But you are correct, your wrapper func would work.

@bep bep closed this as completed in 9c017e5 Sep 19, 2016
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
@github-actions
Copy link

github-actions bot commented Apr 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants