diff --git a/ChangeLog b/ChangeLog index 590b05ec8..88aca373d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ (thanks to Eric Fluger). - TW-1572 Alternative approach to urgency inheritance (thanks to Jens Erat, Wim Schuermann). +- TW-1667 hooks: upon failure indicate which hook failed + (thanks to Daniel Shahaf). - TW-1785 Purge command to remove deleted tasks (thanks to Paul Beckingham). - TW-1772 Implementation of circular dependency detection is diff --git a/src/Hooks.cpp b/src/Hooks.cpp index b6a2dd05f..944e7a0bd 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -138,7 +139,7 @@ void Hooks::onLaunch () const std::vector outputFeedback; separateOutput (output, outputJSON, outputFeedback); - assertNTasks (outputJSON, 0); + assertNTasks (outputJSON, 0, script); if (status == 0) { @@ -147,7 +148,7 @@ void Hooks::onLaunch () const } else { - assertFeedback (outputFeedback); + assertFeedback (outputFeedback, script); for (auto& message : outputFeedback) context.error (message); @@ -200,7 +201,7 @@ void Hooks::onExit () const std::vector outputFeedback; separateOutput (output, outputJSON, outputFeedback); - assertNTasks (outputJSON, 0); + assertNTasks (outputJSON, 0, script); if (status == 0) { @@ -209,7 +210,7 @@ void Hooks::onExit () const } else { - assertFeedback (outputFeedback); + assertFeedback (outputFeedback, script); for (auto& message : outputFeedback) context.error (message); @@ -259,9 +260,9 @@ void Hooks::onAdd (Task& task) const if (status == 0) { - assertNTasks (outputJSON, 1); - assertValidJSON (outputJSON); - assertSameTask (outputJSON, task); + assertNTasks (outputJSON, 1, script); + assertValidJSON (outputJSON, script); + assertSameTask (outputJSON, task, script); // Propagate forward to the next script. input[0] = outputJSON[0]; @@ -271,7 +272,7 @@ void Hooks::onAdd (Task& task) const } else { - assertFeedback (outputFeedback); + assertFeedback (outputFeedback, script); for (auto& message : outputFeedback) context.error (message); @@ -326,9 +327,9 @@ void Hooks::onModify (const Task& before, Task& after) const if (status == 0) { - assertNTasks (outputJSON, 1); - assertValidJSON (outputJSON); - assertSameTask (outputJSON, before); + assertNTasks (outputJSON, 1, script); + assertValidJSON (outputJSON, script); + assertSameTask (outputJSON, before, script); // Propagate accepted changes forward to the next script. input[1] = outputJSON[0]; @@ -338,7 +339,7 @@ void Hooks::onModify (const Task& before, Task& after) const } else { - assertFeedback (outputFeedback); + assertFeedback (outputFeedback, script); for (auto& message : outputFeedback) context.error (message); @@ -399,7 +400,9 @@ bool Hooks::isJSON (const std::string& input) const } //////////////////////////////////////////////////////////////////////////////// -void Hooks::assertValidJSON (const std::vector & input) const +void Hooks::assertValidJSON ( + const std::vector & input, + const std::string& script) const { for (auto& i : input) { @@ -407,7 +410,7 @@ void Hooks::assertValidJSON (const std::vector & input) const i[0] != '{' || i[i.length () - 1] != '}') { - context.error (STRING_HOOK_ERROR_OBJECT); + context.error (format (STRING_HOOK_ERROR_OBJECT, Path (script).name ())); throw 0; } @@ -416,19 +419,19 @@ void Hooks::assertValidJSON (const std::vector & input) const json::value* root = json::parse (i); if (root->type () != json::j_object) { - context.error (STRING_HOOK_ERROR_OBJECT); + context.error (format (STRING_HOOK_ERROR_OBJECT, Path (script).name ())); throw 0; } if (((json::object*)root)->_data.find ("description") == ((json::object*)root)->_data.end ()) { - context.error (STRING_HOOK_ERROR_NODESC); + context.error (format (STRING_HOOK_ERROR_NODESC, Path (script).name ())); throw 0; } if (((json::object*)root)->_data.find ("uuid") == ((json::object*)root)->_data.end ()) { - context.error (STRING_HOOK_ERROR_NOUUID); + context.error (format (STRING_HOOK_ERROR_NOUUID, Path (script).name ())); throw 0; } @@ -452,17 +455,23 @@ void Hooks::assertValidJSON (const std::vector & input) const } //////////////////////////////////////////////////////////////////////////////// -void Hooks::assertNTasks (const std::vector & input, unsigned int n) const +void Hooks::assertNTasks ( + const std::vector & input, + unsigned int n, + const std::string& script) const { if (input.size () != n) { - context.error (format (STRING_HOOK_ERROR_BAD_NUM, n, (int) input.size ())); + context.error (format (STRING_HOOK_ERROR_BAD_NUM, n, (int) input.size (), Path (script).name ())); throw 0; } } //////////////////////////////////////////////////////////////////////////////// -void Hooks::assertSameTask (const std::vector & input, const Task& task) const +void Hooks::assertSameTask ( + const std::vector & input, + const Task& task, + const std::string& script) const { std::string uuid = task.get ("uuid"); @@ -475,7 +484,7 @@ void Hooks::assertSameTask (const std::vector & input, const Task& if (u == root_obj->_data.end () || u->second->type () != json::j_string) { - context.error (format (STRING_HOOK_ERROR_SAME1, uuid)); + context.error (format (STRING_HOOK_ERROR_SAME1, uuid, Path (script).name ())); throw 0; } @@ -485,7 +494,7 @@ void Hooks::assertSameTask (const std::vector & input, const Task& std::string json_uuid = json::decode (text); if (json_uuid != uuid) { - context.error (format (STRING_HOOK_ERROR_SAME2, uuid, json_uuid)); + context.error (format (STRING_HOOK_ERROR_SAME2, uuid, json_uuid, Path (script).name ())); throw 0; } @@ -494,7 +503,9 @@ void Hooks::assertSameTask (const std::vector & input, const Task& } //////////////////////////////////////////////////////////////////////////////// -void Hooks::assertFeedback (const std::vector & input) const +void Hooks::assertFeedback ( + const std::vector & input, + const std::string& script) const { bool foundSomething = false; for (auto& i : input) @@ -503,7 +514,7 @@ void Hooks::assertFeedback (const std::vector & input) const if (! foundSomething) { - context.error (STRING_HOOK_ERROR_NOFEEDBACK); + context.error (format (STRING_HOOK_ERROR_NOFEEDBACK, Path (script).name ())); throw 0; } } diff --git a/src/Hooks.h b/src/Hooks.h index d4e29e9f9..f25915a69 100644 --- a/src/Hooks.h +++ b/src/Hooks.h @@ -47,10 +47,10 @@ private: std::vector scripts (const std::string&) const; void separateOutput (const std::vector &, std::vector &, std::vector &) const; bool isJSON (const std::string&) const; - void assertValidJSON (const std::vector &) const; - void assertNTasks (const std::vector &, unsigned int) const; - void assertSameTask (const std::vector &, const Task&) const; - void assertFeedback (const std::vector &) const; + void assertValidJSON (const std::vector &, const std::string&) const; + void assertNTasks (const std::vector &, unsigned int, const std::string&) const; + void assertSameTask (const std::vector &, const Task&, const std::string&) const; + void assertFeedback (const std::vector &, const std::string&) const; std::vector & buildHookScriptArgs (std::vector &) const; int callHookScript (const std::string&, const std::vector &, std::vector &) const; diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index 70a025325..d40c7a46e 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Leerer Datensatz in der Eingabe." diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index e689aa99d..cfc016a69 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -799,16 +799,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Empty record in input." diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index a1a8432c0..e94c42a8e 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Malplena rikordo en la inigo." diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index 71b7e22a8..f3c5f1ffd 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -810,16 +810,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} tarea restante)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: se esperaba 0bjeto JSON '{...}'." -#define STRING_HOOK_ERROR_NODESC "Hook Error: falta atributo 'description' en objeto JSON." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: falta atributo 'uuid' en objeto JSON." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: se esperaba 0bjeto JSON '{...}' hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: falta atributo 'description' en objeto JSON hook script: {1}." +#define STRING_HOOK_ERROR_NOUUID "Hook Error: falta atributo 'uuid' en objeto JSON hook script: {1}." #define STRING_HOOK_ERROR_SYNTAX "Hook Error: error de sintaxis JSON en: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " // |esp-ESP|==|eng-USA| #define STRING_HOOK_ERROR_NOPARSE "Hook Error: fallo al interpretar JSON: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: se esperaba {1} tarea(s) JSON, se encontraron {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON debe ser para la misma tarea: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON debe ser para la misma tarea: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: se esperaba retro-alimentación desde un hook script que falló." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: se esperaba {1} tarea(s) JSON, se encontraron {2}, hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON debe ser para la misma tarea: {1}, hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON debe ser para la misma tarea: {1} != {2}, hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: se esperaba retro-alimentación desde un hook script que falló: {1}" // Record #define STRING_RECORD_EMPTY "Registro vacío en la entrada." diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index beca6a2ab..61d1c1293 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Empty record in input." diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index e7c80c6ee..2524cecad 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -800,16 +800,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Voce vuota in ingresso." diff --git a/src/l10n/jpn-JPN.h b/src/l10n/jpn-JPN.h index c97b81cc1..bcdbc8ad5 100644 --- a/src/l10n/jpn-JPN.h +++ b/src/l10n/jpn-JPN.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Empty record in input." diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index a31e59bc5..4112e60b1 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Pusty wpis na wejściu." diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index 77525aa0b..6e8eaa224 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -801,16 +801,16 @@ #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." // Hooks -#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." -#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute." -#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute." +#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected from hook script: {1}" +#define STRING_HOOK_ERROR_NODESC "Hook Error: JSON Object missing 'description' attribute from hook script: {1}" +#define STRING_HOOK_ERROR_NOUUID "Hook Error: JSON Object missing 'uuid' attribute from hook script: {1}" #define STRING_HOOK_ERROR_SYNTAX "Hook Error: JSON syntax error in: {1}" #define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " -#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}" -#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}" -#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}" -#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from a failing hook script." +#define STRING_HOOK_ERROR_BAD_NUM "Hook Error: Expected {1} JSON task(s), found {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_SAME1 "Hook Error: JSON must be for the same task: {1}, in hook script: {2}" +#define STRING_HOOK_ERROR_SAME2 "Hook Error: JSON must be for the same task: {1} != {2}, in hook script: {3}" +#define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}" // Record #define STRING_RECORD_EMPTY "Registo vazio na entrada fornecida." diff --git a/test/hooks.on-add.t b/test/hooks.on-add.t index 985a1c444..ad5a2abd1 100755 --- a/test/hooks.on-add.t +++ b/test/hooks.on-add.t @@ -147,7 +147,7 @@ class TestHooksOnAdd(TestCase): self.t.hooks.add_default(hookname, log=True) code, out, err = self.t.runError("add foo") - self.assertIn("Hook Error: JSON Object missing 'uuid' attribute.", err) + self.assertIn("Hook Error: JSON Object missing 'uuid' attribute from hook script: on-add-misbehave6", err) hook = self.t.hooks[hookname] hook.assertTriggeredCount(1) diff --git a/test/hooks.on-modify.t b/test/hooks.on-modify.t index f8f7ce5f6..bf9a40a01 100755 --- a/test/hooks.on-modify.t +++ b/test/hooks.on-modify.t @@ -146,7 +146,7 @@ class TestHooksOnModify(TestCase): code, out, err = self.t("add foo") code, out, err = self.t.runError("1 modify +tag") - self.assertIn("Hook Error: JSON Object missing 'uuid' attribute.", err) + self.assertIn("Hook Error: JSON Object missing 'uuid' attribute from hook script: on-modify-misbehave6", err) hook = self.t.hooks[hookname] hook.assertTriggeredCount(1)