From df5e791b5f811293c6027ac25103ff9cf7db9839 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 24 Feb 2025 20:14:09 +0000 Subject: [PATCH] Change error code --- app/controllers/address_search_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/address_search_controller.rb b/app/controllers/address_search_controller.rb index d06303cfd..8ee67e3bd 100644 --- a/app/controllers/address_search_controller.rb +++ b/app/controllers/address_search_controller.rb @@ -11,7 +11,7 @@ class AddressSearchController < ApplicationController service.call if service.error.present? - render json: { error: service.error }, status: :unprocessable_entity + render json: { error: service.error }, status: :not_found else presenter = UprnDataPresenter.new(service.result) render json: [{ text: presenter.address, value: presenter.uprn }] @@ -22,7 +22,7 @@ class AddressSearchController < ApplicationController service.call if service.error.present? - render json: { error: service.error }, status: :unprocessable_entity + render json: { error: service.error }, status: :not_found else results = service.result.map do |result| presenter = AddressDataPresenter.new(result) @@ -41,7 +41,7 @@ class AddressSearchController < ApplicationController results = (address_service.result || []) + (uprn_service.result || []) if address_service.error.present? && uprn_service.error.present? - render json: { error: "Address and UPRN are not recognised." }, status: :unprocessable_entity + render json: { error: "Address and UPRN are not recognised." }, status: :not_found else formatted_results = results.map do |result| presenter = AddressDataPresenter.new(result)