ArgumentError at GET /produit/attache-sucette-stroufs/

comparison with nil is forbidden as it is unsafe. If you want to check if a value is nil, use is_nil/1 instead

976
977  @doc """
978  Called by escaper at runtime to verify that a value is not nil.
979  """
980  def not_nil!(nil) do
981    raise ArgumentError, "comparison with nil is forbidden as it is unsafe. " <>
982                         "If you want to check if a value is nil, use is_nil/1 instead"
983  end
984  def not_nil!(not_nil) do
985    not_nil
986  end
Ecto.Query.Builder.not_nil!/1 ecto
94  # CATEGORIE
95  # First page
96  def tri_categorie(val, id_cat) do
97    case val do
98      "1" ->
99        from p in Produit,
100          where: p.id_cat == ^id_cat,
101          select: p,
102          limit: 15,
103          order_by: [asc: p.id_produit]
104      "2" ->
Bebemayotte.TriRequette.tri_categorie/2 docs bebemayotte
202      Repo.one(query)
203    end
204
205    # GET 12 PRODUITS
206    def get_produit_limit_twelve_categorie(id_cat, tri) do
207      Repo.all(TriRequette.tri_categorie(tri, id_cat))
208    end
209
210    # GET 12 PRODUITS FROM ID
211    def get_produit_limit_twelve_from_id_next_categorie(id_produit, id_cat, tri) do
212      p = get_produit_by_id_produit(id_produit)
Bebemayotte.ProdRequette.get_produit_limit_twelve_categorie/2 docs bebemayotte
188        nb_ligne = ProdRequette.count_ligne_produit()
189        {produits, nb_ligne}
190      else
191        if souscat == nil do
192          id_cat = CatRequette.get_id_cat_by_nom_cat(cat)
193          produits = ProdRequette.get_produit_limit_twelve_categorie(id_cat, tri)
194          nb_ligne = ProdRequette.count_ligne_produit_categorie(id_cat)
195          {produits, nb_ligne}
196        else
197          id_souscat = SouscatRequette.get_id_souscat_by_nom_souscat(souscat, cat)
198          produits = ProdRequette.get_produit_limit_twelve_souscategorie(id_souscat, tri)
BebemayotteWeb.Live.ProduitLive.filtre/4 bebemayotte
7  alias Bebemayotte.PanierRequette
8
9  def mount(_params, %{"id_session" => session,"user" => user,"cat" => cat, "souscat" => souscat,"list_panier" => list_panier, "search" => search}, socket) do
10    categories = CatRequette.get_all_categorie()
11    souscategories = SouscatRequette.get_all_souscategorie()
12    {produits, nb_ligne} = filtre(cat, souscat, search, "1")
13    nb_total = produits |> Enum.count()
14    {first_row_id, last_row_id} = if_vide_produits(produits, nb_total)
15    nb_page = nb_ligne |> nombre_page()
16    SyncDb.subscribe()
17
BebemayotteWeb.Live.ProduitLive.mount/3 docs bebemayotte
315        [:phoenix, :live_view, :mount],
316        %{socket: socket, params: params, session: session},
317        fn ->
318          socket =
319            params
320            |> view.mount(session, socket)
321            |> handle_mount_result!({:mount, 3, view})
322
323          {socket, %{socket: socket, params: params, session: session}}
324        end
325      )
anonymous fn/4 in Phoenix.LiveView.Utils.maybe_call_live_view_mount!/4 phoenix_live_view
267span(EventPrefix, StartMetadata, SpanFunction) ->
268    StartTime = erlang:monotonic_time(),
269    DefaultCtx = erlang:make_ref(),
270    execute(EventPrefix ++ [start], #{system_time => erlang:system_time()}, merge_ctx(StartMetadata, DefaultCtx)),
271
272    try {_, #{}} = SpanFunction() of
273      {Result, StopMetadata} ->
274          execute(EventPrefix ++ [stop], #{duration => erlang:monotonic_time() - StartTime}, merge_ctx(StopMetadata, DefaultCtx)),
275          Result
276    catch
277        ?WITH_STACKTRACE(Class, Reason, Stacktrace)
:telemetry.span/3 telemetry
311
312  defp call_mount_and_handle_params!(socket, view, session, params, uri) do
313    mount_params = if socket.router, do: params, else: :not_mounted_at_router
314
315    socket
316    |> Utils.maybe_call_live_view_mount!(view, mount_params, session)
317    |> mount_handle_params(view, params, uri)
318    |> case do
319      {:noreply, %Socket{redirected: {:live, _, _}} = socket} ->
320        {:stop, socket}
321
Phoenix.LiveView.Static.call_mount_and_handle_params!/5 phoenix_live_view
127        action,
128        flash,
129        host_uri
130      )
131
132    case call_mount_and_handle_params!(socket, view, mount_session, conn.params, request_url) do
133      {:ok, socket} ->
134        data_attrs = [
135          phx_view: config.name,
136          phx_session: sign_root_session(socket, router, view, to_sign_session),
137          phx_static: sign_static_token(socket)
Phoenix.LiveView.Static.render/3 phoenix_live_view
30        end
31      end
32
33  """
34  def live_render(%Plug.Conn{} = conn, view, opts \\ []) do
35    case LiveView.Static.render(conn, view, opts) do
36      {:ok, content, socket_assigns} ->
37        conn
38        |> Phoenix.Controller.put_view(LiveView.Static)
39        |> LiveView.Plug.put_cache_headers()
40        |> Phoenix.Controller.render(
Phoenix.LiveView.Controller.live_render/3 docs phoenix_live_view
1defmodule BebemayotteWeb.PageController do
2  use BebemayotteWeb, :controller
3
4  alias Phoenix.LiveView
5  alias Bebemayotte.CatRequette
6  alias Bebemayotte.ProdRequette
BebemayotteWeb.PageController.action/2 bebemayotte
1defmodule BebemayotteWeb.PageController do
2  use BebemayotteWeb, :controller
3
4  alias Phoenix.LiveView
5  alias Bebemayotte.CatRequette
6  alias Bebemayotte.ProdRequette
BebemayotteWeb.PageController.phoenix_controller_pipeline/2 bebemayotte
347    case pipeline.(conn) do
348      %Plug.Conn{halted: true} = halted_conn ->
349        halted_conn
350      %Plug.Conn{} = piped_conn ->
351        try do
352          plug.call(piped_conn, plug.init(opts))
353        else
354          conn ->
355            duration = System.monotonic_time() - start
356            metadata = %{metadata | conn: conn}
357            :telemetry.execute([:phoenix, :router_dispatch, :stop], %{duration: duration}, metadata)
Phoenix.Router.__call__/2 phoenix
1defmodule BebemayotteWeb.Endpoint do
2  use Phoenix.Endpoint, otp_app: :bebemayotte
3
4  # The session will be stored in the cookie and signed,
5  # this means its contents can be read but not tampered with.
6  # Set :encryption_salt if you would also like to encrypt it.
BebemayotteWeb.Endpoint.plug_builder_call/2 bebemayotte
No code available.
BebemayotteWeb.Endpoint."call (overridable 3)"/2 bebemayotte
1defmodule BebemayotteWeb.Endpoint do
2  use Phoenix.Endpoint, otp_app: :bebemayotte
3
4  # The session will be stored in the cookie and signed,
5  # this means its contents can be read but not tampered with.
6  # Set :encryption_salt if you would also like to encrypt it.
BebemayotteWeb.Endpoint.call/2 docs bebemayotte
60
61        {:plug, conn, handler, opts} ->
62          %{adapter: {@connection, req}} =
63            conn =
64              conn
65              |> handler.call(opts)
66              |> maybe_send(handler)
67
68          :telemetry.execute(
69            [:plug_adapter, :call, :stop],
70            %{duration: System.monotonic_time() - start},
Phoenix.Endpoint.Cowboy2Handler.init/4 phoenix
32-optional_callbacks([terminate/3]).
33
34-spec execute(Req, Env) -> {ok, Req, Env}
35	when Req::cowboy_req:req(), Env::cowboy_middleware:env().
36execute(Req, Env=#{handler := Handler, handler_opts := HandlerOpts}) ->
37	try Handler:init(Req, HandlerOpts) of
38		{ok, Req2, State} ->
39			Result = terminate(normal, Req2, State, Handler),
40			{ok, Req2, Env#{result => Result}};
41		{Mod, Req2, State} ->
42			Mod:upgrade(Req2, Env, Handler, State);
:cowboy_handler.execute/2 cowboy
301	end.
302
303execute(_, _, []) ->
304	ok;
305execute(Req, Env, [Middleware|Tail]) ->
306	case Middleware:execute(Req, Env) of
307		{ok, Req2, Env2} ->
308			execute(Req2, Env2, Tail);
309		{suspend, Module, Function, Args} ->
310			proc_lib:hibernate(?MODULE, resume, [Env, Tail, Module, Function, Args]);
311		{stop, _Req2} ->
:cowboy_stream_h.execute/3 cowboy
290%% to simplify the debugging of errors. The proc_lib library
291%% already adds the stacktrace to other types of exceptions.
292-spec request_process(cowboy_req:req(), cowboy_middleware:env(), [module()]) -> ok.
293request_process(Req, Env, Middlewares) ->
294	try
295		execute(Req, Env, Middlewares)
296	catch
297		exit:Reason={shutdown, _}:Stacktrace ->
298			erlang:raise(exit, Reason, Stacktrace);
299		exit:Reason:Stacktrace when Reason =/= normal, Reason =/= shutdown ->
300			erlang:raise(exit, {Reason, Stacktrace}, Stacktrace)
:cowboy_stream_h.request_process/3 cowboy
Params
add-to-cart
"11050401"
cat
"attache-sucette-stroufs"
Request info
URI:
http://bbmay.fr:80/produit/attache-sucette-stroufs/
Query string:
add-to-cart=11050401
Headers
accept
*/*
connection
Upgrade
host
bbmay.fr
user-agent
claudebot
x-forwarded-for
3.238.79.169
x-real-ip
3.238.79.169
Session
_navigation_history_default
"/produit/attache-sucette-stroufs/?add-to-cart=11050401"