SJRK-419: Make server log and error messages localized

Metadata

Source
SJRK-419
Type
Improvement
Priority
Major
Status
Open
Resolution
N/A
Assignee
N/A
Reporter
Gregor Moss
Created
2020-11-09T14:01:49.702-0500
Updated
2020-11-09T14:01:49.702-0500
Versions
N/A
Fixed Versions
N/A
Component
  1. Storytelling Tool Server

Description

The logging and error messages in the Storytelling Tool server code are currently hardcoded in the functions, which is brittle and difficult to manage. Make the messages configurable externally and localized, such that they are all stored in and managed from the same location.

E.g.

sjrk.storyTelling.server.saveStoryToDatabase = function (dataSource, storyModel, successEvent, failureEvent) {
    var id = fluid.get(storyModel, "id") || uuidv4();

    dataSource.set({directStoryId: id}, storyModel).then(function (response) {
        successEvent.fire(JSON.stringify(response));
    }, function (error) {
        failureEvent.fire({
            isError: true,
            message: error.reason || "Unspecified server error saving story to database."
        });
    });
};

would become something like

sjrk.storyTelling.server.saveStoryToDatabase = function (dataSource, storyModel, successEvent, failureEvent) {
    var id = fluid.get(storyModel, "id") || uuidv4();

    dataSource.set({directStoryId: id}, storyModel).then(function (response) {
        successEvent.fire(JSON.stringify(response));
    }, function (error) {
        failureEvent.fire({
            isError: true,
            message: error.reason || messages.unspecifiedStorySaveError;
        });
        // NOTE: this example doesn't describe how the message string
        // is accessible to the function
    });
};