Skip to content

cannot call outer functions inside a promise #358

Description

@vans163
app.js:3889 Uncaught (in promise) ReferenceError: handle_fetch_error is not defined
    at recur (app.js:3889)
    at Object.trampoline$1 [as trampoline] (app.js:7)
    at window.fetch.then.__function_args__ (app.js:3895)
    at <anonymous>
    def handle_fetch_error(reply) do
        case reply.ok do
            true -> reply.text()
            false -> throw(reply.statusText)
        end
    end

    def call(map) do
        params = %{method: "POST", body: JSON.stringify(map)}
        Window.fetch("/api", ElixirScript.JS.map_to_object(params))
            .then(fn(r)-> handle_fetch_error(r) end)
            .then(fn(text)-> Console.log(text) end)
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions