mnkhod

mnkhod

So i have been using ash framework for a while and i love it. However currently the issue im having with ash framework is the error handling side of things on LiveView.

I understand there is 4 main category on the error class which are forbidden/invalid/framework/unknown. This is great but the problem is having to manage more than 1 errors. I understand the use case that errors propogating and coming as a list is great but what if i wanna show only 1 error since my frontend toast can only show 1 error message and having multiple error message would ruin it. Hence is there any configuration on ash action that allows me to say if any error occur then send that error and stop the whole action?

Having this would allow my invoking of code interface inside case statement be more lean since i can just pattern match on 1 error message to show multiple possible errrors inside put_flash.

Having to pattern match on Ash.Error.Invalid errors list with Enum.find and match function is making me go crazy.

Isnt this more lean tho? pls let me know if im being dumb

Showing Posts 1 to 1

zachdaniel

zachdaniel

Creator of Ash

I might need to see some code examples of how exactly you’re using it in your LV, but in general you can do things like this just fine:

defp get_one_error(%{errors: [error | _]}), do: error
defp get_one_error(error), do: error # fallback to using the class error in case you somehow just get one of those back

Ash itself doesn’t provide a way to just automatically stop on the first error and raise or return that, so whatever you do would need to be solved outside of the core calls.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
perzanko
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews