fission-codes / fission

Fission CLI & server
https://runfission.com/docs
119 stars 14 forks source link

Add new errors for a few failure cases #570

Closed QuinnWilton closed 2 years ago

QuinnWilton commented 2 years ago

Summary

This PR resolves a few minor UX issues I ran into while using the tool today. In particular, it:

Feel free to nitpick this as much as you'd like; I haven't worked with the repo before, and I'm out of practice with Haskell, so it's likely I'm missing some idioms!

In particular, I suspect some of these error strings should be pulled into Fission.CLI.Error.Types. Then I could probably define a helper somewhere that translates the NotFound FilePath into a NotConfigured error that more nicely encapsulates this concern.

I avoided doing that to keep these changes small and avoid imposing too large of a review burden onto anyone, but I'm happy to make any adjustments!

Test plan (required)

app publish with an unregistered app:

[nix-shell:~/dev/fission]$ cat fission.yaml
ignore: []
url: does-not-exist.fission.app
build: ./assets

[nix-shell:~/dev/fission]$ stack run -- app publish
🕛🛫 App publish local preflight
🕑✈️  Pushing to remotePeer List...
🚫 The app has not yet been registered. Please delete your fission.yaml and run `fission app register --name some-name`

[nix-shell:~/dev/fission]$ rm fission.yaml

[nix-shell:~/dev/fission]$ stack run -- app register
👷 Choose build directory (.): assets
✅ App initialized as geriatric-yellow-centaur.fission.app
⏯️  Next run fission app publish [--open|--watch] to sync data
💁 It may take DNS time to propagate this initial setup globally. In this case, you can always view your app at https://ipfs.runfission.com/ipns/geriatric-yellow-centaur.fission.app

[nix-shell:~/dev/fission]$ stack run -- app publish
🕛🛫 App publish local preflight
🕒✈️  Pushing to remotePeer List...
🚀 Now live on the network
📝 DNS updated! Check out your site at: 
🔗 geriatric-yellow-centaur.fission.app

app register and whoami without being logged in:

[nix-shell:~/dev/fission]$ cat ~/.config/fission/config.yaml
cat: /Users/quinn/.config/fission/config.yaml: No such file or directory

[nix-shell:~/dev/fission]$ stack run -- app register
🚫 Fission is installed, but you are not logged in. Please run `fission login`

[nix-shell:~/dev/fission]$ stack run -- whoami      
🚫 Fission is installed, but you are not logged in. Please run `fission login`

[nix-shell:~/dev/fission]$ mv ~/.config/fission/config.yaml.old ~/.config/fission/config.yaml

[nix-shell:~/dev/fission]$ stack run -- app register
👷 Choose build directory (.): ^C

[nix-shell:~/dev/fission]$ stack run -- whoami
💻 Currently logged in as: quinn
expede commented 2 years ago

Closes #569

QuinnWilton commented 2 years ago

This PR was discussed on my call with @expede today, and she said to go ahead and merge it once I had a chance :)