Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Sep 19, 2024
1 parent acaad4a commit 98e39b5
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def store_request_id
Thread.current[:request_id] = request.uuid
end

def handle_standard_error(exception)
render json: { error: exception.message }, status: :internal_server_error
def handle_standard_error(error)
render json: { error: error.message }, status: :internal_server_error
end

def handle_auth_error(exception)
def handle_auth_error(error)
render json: { error: "Unauthorized" }, status: :unauthorized
end

def handle_bad_request(exception)
render json: { error: exception.message }, status: :bad_request
def handle_bad_request(error)
render json: { error: error.message }, status: :bad_request
end
end
2 changes: 1 addition & 1 deletion app/interactors/application_interactor.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ApplicationInteractor
include Interactor

def log
def audit_log
result = context.success? ? "success" : "failure"
level = context.success? ? :info : :error
payload = {
Expand Down
2 changes: 1 addition & 1 deletion app/interactors/authenticate_identity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def call
context.fail!(message: "Invalid token")
end
ensure
log
audit_log
end
end
2 changes: 1 addition & 1 deletion app/interactors/authorize_cert_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def call
end
nil
ensure
log
audit_log
end
end
2 changes: 1 addition & 1 deletion app/interactors/delete_secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class DeleteSecret < ApplicationInteractor
def call
Services::SecretsService.kv_delete(context.request.path)
ensure
log
audit_log
end
end
2 changes: 1 addition & 1 deletion app/interactors/obtain_cert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def call
context.fail!(message: "Failed to issue certificate")
end
ensure
log
audit_log
end
end
2 changes: 1 addition & 1 deletion app/interactors/read_secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def call
context.fail!(message: "Failed to read secret")
end
ensure
log
audit_log
end
end
2 changes: 1 addition & 1 deletion app/interactors/write_secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ def call
context.fail!(message: "Failed to store secret")
end
ensure
log
audit_log
end
end
4 changes: 2 additions & 2 deletions test/interactors/application_interactor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def teardown
Object.const_set("SuccessAction", Class.new(ApplicationInteractor) do
def call
ensure
log
audit_log
end
end)
rslt = SuccessAction.call(identity: @identity, request: @cr)
Expand All @@ -31,7 +31,7 @@ def call
def call
context.fail!
ensure
log
audit_log
end
end)
rslt = FailAction.call(identity: @identity, request: @cr)
Expand Down

0 comments on commit 98e39b5

Please sign in to comment.