gradefast/gradebook/static/js/utils.js
/**
 * Parse a string as JSON data, reporting an error if it cannot be parsed.
 * @param {string} str - The string containing the JSON data.
 * @param {string} errorPath - The path to use for an error message.
 * @param {string} errorStatus - The status to use for an error message.
 * @param [errorObjects] - Any objects to log with an error message.
 */
Parse a string as JSON data, reporting an error if it cannot be parsed.
@param {string} str - The string containing the JSON data.
@param {string} errorPath - The path to use for an error message.
@param {string} errorStatus - The status to use for an error message.
@param [errorObjects] - Any objects to log with an error message.
Parse a string as JSON data reporting an error if it cannot be parsed . @param { string } str - The string containing the JSON data . @param { string } errorPath - The path to use for an error message . @param { string } errorStatus - The status to use for an error message . @param [ errorObjects ] - Any objects to log with an error message .
function parseJson(str, errorPath, errorStatus, ...errorObjects) {
    let jsonData;
    try {
        jsonData = JSON.parse(str);
    } catch (err) {
        reportResponseError(errorPath, errorStatus, str, err, ...errorObjects);
    }
    return jsonData;
}
function parseJson ( str , errorPath , errorStatus , ... errorObjects ) { let jsonData ; try { jsonData = JSON . parse ( str ) ; } catch ( err ) { reportResponseError ( errorPath , errorStatus , str , err , ... errorObjects ) ; } return jsonData ; }
Parse a string as JSON data, reporting an error if it cannot be parsed.
Parse a string as JSON data reporting an error if it cannot be parsed .