How to get stack of errors?

I get this error in logger:

18:28:06.070 [error] GenServer #PID<0.587.0> terminating
** (stop) {%CQEx.Error{message: ““Invalid null value in condition for column organization_id (Code 8704)””, stack: []}, []}
Last message: %Phoenix.Socket.Message{event: “new_location”, payload: %{“at” => “1:30…am”, “lat” => 31.958609999999926, “long” => 35.947710000000164, “user_id” => 1}, ref: “76”, topic: “users:1”}
State: %Phoenix.Socket{assigns: %{team_users_ids_who_can_see_owner: [], user: %App.User{meta: #Ecto.Schema.Metadata<:loaded, “users”>, email: "admin@admin.com", id: 1, organization_id: 1}, watchers: [1]}, channel: App.UserChannel, channel_pid: #PID<0.587.0>, endpoint: App.Endpoint, handler: App.UserSocket, id: nil, joined: true, pubsub_server: App.PubSub, ref: nil, serializer: Phoenix.Transports.WebSocketSerializer, topic: “users:1”, transport: Phoenix.Transports.WebSocket, transport_name: :websocket, transport_pid: #PID<0.560.0>}

However, in the error above, stack: [] therefore, I can’t determine where is the cause of error.

Any idea how to get stack? is this related to logger lib I am using https://github.com/onkel-dirtus/logger_file_backend/issues ?

1 Like

‘Stack’ comes from the CQEx library: https://github.com/matehat/cqex/blob/5896591ab1e6680da9be7b82ed298ee217a030a2/lib/cqex.ex#L40

I’m not sure why it’s not populated in all cases. I think you could hack this line to insert it: https://github.com/matehat/cqex/blob/master/lib/cqex/query.ex#L80

2 Likes