rellen
rellen
AEAsh Elixir
Created by rellen on 9/22/2023 in #support
pub_sub compilation issue
After updating to ash main, commit id: 2813b3c9b2f45d1aec6aff2a64920404a42ac839 I'm getting the following error on compilation related to pub_sub Given this line in a pub_sub: publish :create, ["changed", :parent_id, [:id, nil]] Getting this compilation error:
** (Spark.Error.DslError) [MySuperSecretProject.SomeResource]
pub_sub -> publish:
invalid value for :topic option: invalid list in :topic option: expected list element at position 2 to match at least one given type, but didn't match any. Here are the reasons why it didn't match each of the allowed types:

* invalid value for list element at position 2: expected atom, got: [:id, nil]
* invalid value for list element at position 2: expected string, got: [:id, nil]
** (Spark.Error.DslError) [MySuperSecretProject.SomeResource]
pub_sub -> publish:
invalid value for :topic option: invalid list in :topic option: expected list element at position 2 to match at least one given type, but didn't match any. Here are the reasons why it didn't match each of the allowed types:

* invalid value for list element at position 2: expected atom, got: [:id, nil]
* invalid value for list element at position 2: expected string, got: [:id, nil]
5 replies
AEAsh Elixir
Created by rellen on 9/6/2023 in #support
AshOban trigger `read_metadata` passed to action as argument?
Hello! In the AshOban code, there is this documentation statement: https://github.com/ash-project/ash_oban/blob/main/lib/ash_oban.ex#L129 I can't see where metadata is passed to the update action. I presume it would be somewhere here: https://github.com/ash-project/ash_oban/blob/main/lib/transformers/define_schedulers.ex#L477-L492 What am I missing? Has this part of the feature been missed, or was it never the intention to grab the metadata back out of the Oban job table into Ash land again?
6 replies
AEAsh Elixir
Created by rellen on 6/20/2023 in #support
`mix doctor` shows errors for "struct spec" on resource modules
Hello. I'm getting errors in mix doctor on resource modules, like so...
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Doc Cov Spec Cov Module File Functions No Docs No Specs Module Doc Struct Spec
...
N/A N/A SomeMod some_mod.ex 0 0 0 Yes No
...
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Doc Cov Spec Cov Module File Functions No Docs No Specs Module Doc Struct Spec
...
N/A N/A SomeMod some_mod.ex 0 0 0 Yes No
...
What should I do to appease mix doctor for resources? Thanks!
4 replies
AEAsh Elixir
Created by rellen on 6/7/2023 in #support
Ash.Error as application's exception/error module
Hello.
In a previous project (which did not use Ash) we had a top-level Error module that had a defexception in it with all the typical error things, like codes, messages, and metadata. It also had some other functions to do things like, for example, report the error to various sinks (Logger and an APM platform). The idea was to replace returns like {:error, :some_error_code} or {:error, "some message"} with {:error, MyApp.Error.exception(...)} and let code that receives such errors decide it it wants to report, re-raise, etc etc. With the existence of Ash.Error and all the helper code around it, I wonder if it makes sense to build an application's top-level error off of Ash.Error instead of something custom? Even if those errors might not have anything to do with Ash? Is it the intention of Ash.Error to be used purely for errors coming from the framework, or is it a building block for user-defined errors? Does anyone have any experience or thoughts on this? Thanks!
2 replies