exAspArk / graphql-errors

Simple error handler for GraphQL Ruby :exclamation:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"\n" in errors message?

opened this issue · comments

With this:

  rescue_from ActiveRecord::RecordInvalid do |exception|
    GraphQL::ExecutionError.new(exception.record.errors.full_messages.join("\n"))
  end

I get this:

{
	"data": {
		"createUser": null
	},
	"errors": [
		{
			"message": "Email is invalid\nEmail can't be blank",
			"locations": [
				{
					"line": 2,
					"column": 3
				}
			],
			"path": [
				"createUser"
			]
		}
	]
}

with "\n" in error message. Is this ok?

Yeah, it might be a , or ; instead of \n, for example.
Feel free to open a PR to change it if you'd like :)