Skip to content

How to use Try Catch  #2

@Nicomedis

Description

@Nicomedis

Interesting work. I am also playing around with this idea.
but i have problem when implement try catch on function with return value
i got error
cannot use func literal (type func() revel.Result) as type func(

I am using the try catch within a function that returns value like this, but still got the error:

func (c ToDo) Show(todo int) revel.Result { try.This(func() { panic("my panic") return c.RenderJSON("test") }).Catch(func(e try.E) { // Print crash return c.RenderJSON(e) }) }

is it done in wrong way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions