From 10695dcc9884378d85811cf7d1dc0939447201c3 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Wed, 13 May 2020 15:43:59 -0500 Subject: [PATCH] Store MARK AS failure logs --- .../lib/farmbot_os/sys_calls/resource_update.ex | 11 ++++++++--- .../test/farmbot_os/syscalls/resource_update_test.exs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex b/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex index e72af478..9ba7e954 100644 --- a/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex +++ b/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex @@ -74,11 +74,16 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do :ok else nil -> - {:error, - "#{type}.#{id} is not currently synced, so it could not be updated"} + msg = "#{type}.#{id} is not currently synced. Please re-sync." + FarmbotCore.Logger.error(3, msg) + {:error, msg} {:error, _changeset} -> - {:error, "Failed to update #{type}.#{id}"} + msg = + "Failed update (#{type}.#{id}): Ensure the data is properly formatted" + + FarmbotCore.Logger.error(3, msg) + {:error, msg} end end diff --git a/farmbot_os/test/farmbot_os/syscalls/resource_update_test.exs b/farmbot_os/test/farmbot_os/syscalls/resource_update_test.exs index 1cbceff0..9a1cd4f0 100644 --- a/farmbot_os/test/farmbot_os/syscalls/resource_update_test.exs +++ b/farmbot_os/test/farmbot_os/syscalls/resource_update_test.exs @@ -34,7 +34,7 @@ defmodule FarmbotOS.SysCalls.ResourceUpdateTest do assert String.contains?(next_plant.name, "Updated to ") bad_result1 = ResourceUpdate.update_resource("Plant", 0, params) - error = "Plant.0 is not currently synced, so it could not be updated" + error = "Plant.0 is not currently synced. Please re-sync." assert {:error, error} == bad_result1 end