import json


def build_error_json(errorCode, errorType, message, httpCode):
    """Builds the error json string.

    When an error is encountered during execution, this function is called by the error_handler
    function to build a properly formatted json string error.

    Parameters
    -----------
    errorCode : string
        The original error code created when the error was encountered.
    errorType : string
        Reserved for future use.
    message : string
        More details about the error which should be included in the error object returned.
    httpCode : int
        The 3 digit HTTP code associated with this error. (200, 300, 400)

    Returns
    -----------
    json string
        The error message in a properly formatted json string.

    """     
    
    # Build the JSON string using the inputs to the function.
    jsonResp = '{"errorType":"' + errorType + '", "errorCode":"' + errorCode + '", "httpCode":"' + httpCode + '", "message":"' + message + '"}'

    # Properly format the error object into JSON
    jsonResp = json.loads(jsonResp)
    # Convert the properly formatted JSON object back to a string, and pretty-print it for return.
    jsonResp = json.dumps(jsonResp, indent=2)

    return jsonResp