TW-1667: hooks: upon failure indicate which hook failed

- Thanks to Daniel Shahaf.
This commit is contained in:
Paul Beckingham 2017-01-16 13:14:08 -05:00
parent 444e16fdd2
commit b21e0baa47
14 changed files with 106 additions and 93 deletions

View file

@ -8,6 +8,8 @@
(thanks to Eric Fluger). (thanks to Eric Fluger).
- TW-1572 Alternative approach to urgency inheritance - TW-1572 Alternative approach to urgency inheritance
(thanks to Jens Erat, Wim Schuermann). (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 - TW-1785 Purge command to remove deleted tasks
(thanks to Paul Beckingham). (thanks to Paul Beckingham).
- TW-1772 Implementation of circular dependency detection is - TW-1772 Implementation of circular dependency detection is

View file

@ -42,6 +42,7 @@
#include <Lexer.h> #include <Lexer.h>
#include <JSON.h> #include <JSON.h>
#include <Timer.h> #include <Timer.h>
#include <FS.h>
#include <format.h> #include <format.h>
#include <shared.h> #include <shared.h>
#include <util.h> #include <util.h>
@ -138,7 +139,7 @@ void Hooks::onLaunch () const
std::vector <std::string> outputFeedback; std::vector <std::string> outputFeedback;
separateOutput (output, outputJSON, outputFeedback); separateOutput (output, outputJSON, outputFeedback);
assertNTasks (outputJSON, 0); assertNTasks (outputJSON, 0, script);
if (status == 0) if (status == 0)
{ {
@ -147,7 +148,7 @@ void Hooks::onLaunch () const
} }
else else
{ {
assertFeedback (outputFeedback); assertFeedback (outputFeedback, script);
for (auto& message : outputFeedback) for (auto& message : outputFeedback)
context.error (message); context.error (message);
@ -200,7 +201,7 @@ void Hooks::onExit () const
std::vector <std::string> outputFeedback; std::vector <std::string> outputFeedback;
separateOutput (output, outputJSON, outputFeedback); separateOutput (output, outputJSON, outputFeedback);
assertNTasks (outputJSON, 0); assertNTasks (outputJSON, 0, script);
if (status == 0) if (status == 0)
{ {
@ -209,7 +210,7 @@ void Hooks::onExit () const
} }
else else
{ {
assertFeedback (outputFeedback); assertFeedback (outputFeedback, script);
for (auto& message : outputFeedback) for (auto& message : outputFeedback)
context.error (message); context.error (message);
@ -259,9 +260,9 @@ void Hooks::onAdd (Task& task) const
if (status == 0) if (status == 0)
{ {
assertNTasks (outputJSON, 1); assertNTasks (outputJSON, 1, script);
assertValidJSON (outputJSON); assertValidJSON (outputJSON, script);
assertSameTask (outputJSON, task); assertSameTask (outputJSON, task, script);
// Propagate forward to the next script. // Propagate forward to the next script.
input[0] = outputJSON[0]; input[0] = outputJSON[0];
@ -271,7 +272,7 @@ void Hooks::onAdd (Task& task) const
} }
else else
{ {
assertFeedback (outputFeedback); assertFeedback (outputFeedback, script);
for (auto& message : outputFeedback) for (auto& message : outputFeedback)
context.error (message); context.error (message);
@ -326,9 +327,9 @@ void Hooks::onModify (const Task& before, Task& after) const
if (status == 0) if (status == 0)
{ {
assertNTasks (outputJSON, 1); assertNTasks (outputJSON, 1, script);
assertValidJSON (outputJSON); assertValidJSON (outputJSON, script);
assertSameTask (outputJSON, before); assertSameTask (outputJSON, before, script);
// Propagate accepted changes forward to the next script. // Propagate accepted changes forward to the next script.
input[1] = outputJSON[0]; input[1] = outputJSON[0];
@ -338,7 +339,7 @@ void Hooks::onModify (const Task& before, Task& after) const
} }
else else
{ {
assertFeedback (outputFeedback); assertFeedback (outputFeedback, script);
for (auto& message : outputFeedback) for (auto& message : outputFeedback)
context.error (message); context.error (message);
@ -399,7 +400,9 @@ bool Hooks::isJSON (const std::string& input) const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Hooks::assertValidJSON (const std::vector <std::string>& input) const void Hooks::assertValidJSON (
const std::vector <std::string>& input,
const std::string& script) const
{ {
for (auto& i : input) for (auto& i : input)
{ {
@ -407,7 +410,7 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
i[0] != '{' || i[0] != '{' ||
i[i.length () - 1] != '}') i[i.length () - 1] != '}')
{ {
context.error (STRING_HOOK_ERROR_OBJECT); context.error (format (STRING_HOOK_ERROR_OBJECT, Path (script).name ()));
throw 0; throw 0;
} }
@ -416,19 +419,19 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
json::value* root = json::parse (i); json::value* root = json::parse (i);
if (root->type () != json::j_object) if (root->type () != json::j_object)
{ {
context.error (STRING_HOOK_ERROR_OBJECT); context.error (format (STRING_HOOK_ERROR_OBJECT, Path (script).name ()));
throw 0; throw 0;
} }
if (((json::object*)root)->_data.find ("description") == ((json::object*)root)->_data.end ()) 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; throw 0;
} }
if (((json::object*)root)->_data.find ("uuid") == ((json::object*)root)->_data.end ()) 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; throw 0;
} }
@ -452,17 +455,23 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Hooks::assertNTasks (const std::vector <std::string>& input, unsigned int n) const void Hooks::assertNTasks (
const std::vector <std::string>& input,
unsigned int n,
const std::string& script) const
{ {
if (input.size () != n) 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; throw 0;
} }
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Hooks::assertSameTask (const std::vector <std::string>& input, const Task& task) const void Hooks::assertSameTask (
const std::vector <std::string>& input,
const Task& task,
const std::string& script) const
{ {
std::string uuid = task.get ("uuid"); std::string uuid = task.get ("uuid");
@ -475,7 +484,7 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
if (u == root_obj->_data.end () || if (u == root_obj->_data.end () ||
u->second->type () != json::j_string) 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; throw 0;
} }
@ -485,7 +494,7 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
std::string json_uuid = json::decode (text); std::string json_uuid = json::decode (text);
if (json_uuid != uuid) 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; throw 0;
} }
@ -494,7 +503,9 @@ void Hooks::assertSameTask (const std::vector <std::string>& input, const Task&
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Hooks::assertFeedback (const std::vector <std::string>& input) const void Hooks::assertFeedback (
const std::vector <std::string>& input,
const std::string& script) const
{ {
bool foundSomething = false; bool foundSomething = false;
for (auto& i : input) for (auto& i : input)
@ -503,7 +514,7 @@ void Hooks::assertFeedback (const std::vector <std::string>& input) const
if (! foundSomething) if (! foundSomething)
{ {
context.error (STRING_HOOK_ERROR_NOFEEDBACK); context.error (format (STRING_HOOK_ERROR_NOFEEDBACK, Path (script).name ()));
throw 0; throw 0;
} }
} }

View file

@ -47,10 +47,10 @@ private:
std::vector <std::string> scripts (const std::string&) const; std::vector <std::string> scripts (const std::string&) const;
void separateOutput (const std::vector <std::string>&, std::vector <std::string>&, std::vector <std::string>&) const; void separateOutput (const std::vector <std::string>&, std::vector <std::string>&, std::vector <std::string>&) const;
bool isJSON (const std::string&) const; bool isJSON (const std::string&) const;
void assertValidJSON (const std::vector <std::string>&) const; void assertValidJSON (const std::vector <std::string>&, const std::string&) const;
void assertNTasks (const std::vector <std::string>&, unsigned int) const; void assertNTasks (const std::vector <std::string>&, unsigned int, const std::string&) const;
void assertSameTask (const std::vector <std::string>&, const Task&) const; void assertSameTask (const std::vector <std::string>&, const Task&, const std::string&) const;
void assertFeedback (const std::vector <std::string>&) const; void assertFeedback (const std::vector <std::string>&, const std::string&) const;
std::vector <std::string>& buildHookScriptArgs (std::vector <std::string>&) const; std::vector <std::string>& buildHookScriptArgs (std::vector <std::string>&) const;
int callHookScript (const std::string&, const std::vector <std::string>&, std::vector <std::string>&) const; int callHookScript (const std::string&, const std::vector <std::string>&, std::vector <std::string>&) const;

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Leerer Datensatz in der Eingabe." #define STRING_RECORD_EMPTY "Leerer Datensatz in der Eingabe."

View file

@ -796,16 +796,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Empty record in input." #define STRING_RECORD_EMPTY "Empty record in input."

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Malplena rikordo en la inigo." #define STRING_RECORD_EMPTY "Malplena rikordo en la inigo."

View file

@ -807,16 +807,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} tarea restante)." #define STRING_HELPER_PROJECT_REM1 "({1} tarea restante)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: se esperaba 0bjeto 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." #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." #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_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_JSON "Hook Error: JSON " // |esp-ESP|==|eng-USA|
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: fallo al interpretar JSON: " #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_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}" #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}" #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ó." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: se esperaba retro-alimentación desde un hook script que falló: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Registro vacío en la entrada." #define STRING_RECORD_EMPTY "Registro vacío en la entrada."

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Empty record in input." #define STRING_RECORD_EMPTY "Empty record in input."

View file

@ -797,16 +797,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Voce vuota in ingresso." #define STRING_RECORD_EMPTY "Voce vuota in ingresso."

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Empty record in input." #define STRING_RECORD_EMPTY "Empty record in input."

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Pusty wpis na wejściu." #define STRING_RECORD_EMPTY "Pusty wpis na wejściu."

View file

@ -798,16 +798,16 @@
#define STRING_HELPER_PROJECT_REM1 "({1} task remaining)." #define STRING_HELPER_PROJECT_REM1 "({1} task remaining)."
// Hooks // Hooks
#define STRING_HOOK_ERROR_OBJECT "Hook Error: JSON Object '{...}' expected." #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." #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." #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_SYNTAX "Hook Error: JSON syntax error in: {1}"
#define STRING_HOOK_ERROR_JSON "Hook Error: JSON " #define STRING_HOOK_ERROR_JSON "Hook Error: JSON "
#define STRING_HOOK_ERROR_NOPARSE "Hook Error: JSON failed to parse: " #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_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}" #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}" #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 a failing hook script." #define STRING_HOOK_ERROR_NOFEEDBACK "Hook Error: Expected feedback from failing hook script: {1}"
// Record // Record
#define STRING_RECORD_EMPTY "Registo vazio na entrada fornecida." #define STRING_RECORD_EMPTY "Registo vazio na entrada fornecida."

View file

@ -147,7 +147,7 @@ class TestHooksOnAdd(TestCase):
self.t.hooks.add_default(hookname, log=True) self.t.hooks.add_default(hookname, log=True)
code, out, err = self.t.runError("add foo") 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 = self.t.hooks[hookname]
hook.assertTriggeredCount(1) hook.assertTriggeredCount(1)

View file

@ -146,7 +146,7 @@ class TestHooksOnModify(TestCase):
code, out, err = self.t("add foo") code, out, err = self.t("add foo")
code, out, err = self.t.runError("1 modify +tag") 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 = self.t.hooks[hookname]
hook.assertTriggeredCount(1) hook.assertTriggeredCount(1)