Skip to content

Add query_error_to_string#31

Draft
sporto wants to merge 1 commit intolpil:mainfrom
sporto:query_error_to_string
Draft

Add query_error_to_string#31
sporto wants to merge 1 commit intolpil:mainfrom
sporto:query_error_to_string

Conversation

@sporto
Copy link

@sporto sporto commented Jul 4, 2024

I would like to have a quick way to convert the query errors to a string

fn find_user(email: String) ->  Result(User, String) {
  ...

  use returned <- result.try(
    pgo.execute(select_sql, db, [pgo.text(email)], return_type)
    |> result.map_error(pgo.query_error_to_string),
  )

  ...
}

What do you think?
Would be nice if dynamic could have this too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant