Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error404 now handled correctly for listeners #238

Merged
merged 1 commit into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions apps/lenra/lib/lenra/services/openfaas_services.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ defmodule Lenra.OpenfaasServices do
:ok ->
:ok

{:error, :ressource_not_found} ->
{:error, :listener_not_found}

err ->
err
end
Expand Down Expand Up @@ -126,7 +123,7 @@ defmodule Lenra.OpenfaasServices do
{:ok, %{"widget" => widget}} ->
{:ok, widget}

{:error, :ressource_not_found} ->
:error404 ->
{:error, :widget_not_found}

err ->
Expand Down Expand Up @@ -155,7 +152,7 @@ defmodule Lenra.OpenfaasServices do
Logger.debug("Got manifest : #{inspect(manifest)}")
{:ok, manifest}

{:error, :ressource_not_found} ->
:error404 ->
{:error, :manifest_not_found}

err ->
Expand Down Expand Up @@ -276,7 +273,7 @@ defmodule Lenra.OpenfaasServices do

404 ->
Logger.error(body)
{:error, :ressource_not_found}
:error404

500 ->
Logger.error(body)
Expand Down
12 changes: 6 additions & 6 deletions apps/lenra_web/lib/lenra_web/application_runner_adapter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ defmodule LenraWeb.ApplicationRunnerAdapter do
"""
@behaviour ApplicationRunner.AdapterBehavior

alias ApplicationRunner.{Data, EnvState, SessionState}
alias Lenra.{DataServices, OpenfaasServices, User, UserDataServices}
alias ApplicationRunner.{EnvState, SessionState}
alias Lenra.{DataServices, OpenfaasServices, UserDataServices}
require Logger

@impl true
Expand Down Expand Up @@ -89,6 +89,10 @@ defmodule LenraWeb.ApplicationRunnerAdapter do
send(socket_pid, {:send, atom, ui_or_patches})
end

def on_ui_changed(session_state, message) do
raise "Error, not maching on_ui_changed/2 #{inspect(session_state)}, #{inspect(message)}"
end

@impl true
def exec_query(%SessionState{assigns: %{environment: env, user: user}}, query) do
DataServices.exec_query(query, env.id, user.id)
Expand All @@ -104,10 +108,6 @@ defmodule LenraWeb.ApplicationRunnerAdapter do
UserDataServices.create_user_data(env.id, user.id)
end

def on_ui_changed(session_state, message) do
raise "Error, not maching on_ui_changed/2 #{inspect(session_state)}, #{inspect(message)}"
end

def additional_session_modules(opts) do
[{Lenra.TokenAgent, opts}]
end
Expand Down