gren-lang / gren-lang/node

Ability to "fail to start"

Open
#36 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
13
Forks
6
Avg merge
5d 20h
Merged PRs (30d)
3

Description

Currently if your application model depends on the result of a task that can fail, you need to keep a Maybe on the model, because you have to call Node.startProgram with an instance of your model no matter what. If there was a way to explicitly not start the program, you could avoid the Maybe and fail directly in init. For example:


getSecureContext : Task Never (Maybe Crypto.SecureContext)
getSecureContext =
    -- Turn fail-able task into one that always resolves. 
    ...

init env =
    Init.await getSecureContext <| \maybeSecureContext ->
        when maybeSecureContext is
            Nothing ->
                Node.failToStart "Failed to get secure context."
            Just secureContext ->
                Node.startProgram
                    { model =
                        { secureContext = secureContext -- don't need a Maybe
                        ...

Probably will want something similar for Browser.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Node.startProgram entry point and compare it with the Browser startup API, since the issue suggests both need similar behavior. Determine how init currently handles a task result and define what an explicit failure path should mean; done means applications can fail during initialization without storing a Maybe in the model.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.