From c39d00e801f6daab57f852b08c856e6cee83ea52 Mon Sep 17 00:00:00 2001 From: timothyjb Date: Sat, 14 Aug 2021 15:15:49 -0400 Subject: [PATCH] return-netsuite-error-for-search-action-failures Why Currently, if the `Search` action is unsuccessful, it will simply return `false` and give no insight into what the error was. Looking at patterns implemented elsewhere in the codebase, we seem to be moving towards returning a `NetSuite::Error` if the response is not successful. Solution Return a `NetSuite::Error` if the response is not successful. --- lib/netsuite/actions/search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite/actions/search.rb b/lib/netsuite/actions/search.rb index e5f8420dd..0e319175b 100644 --- a/lib/netsuite/actions/search.rb +++ b/lib/netsuite/actions/search.rb @@ -244,7 +244,7 @@ def search(options = { }, credentials={}) if response.success? NetSuite::Support::SearchResult.new(response, self, credentials) else - false + NetSuite::Error.new(response.body[:status][:status_detail]) end end end