TwoPint.DOCmdlets.psm1

function Get-TwoPintDOErrorsTable(){
    $errorsObj = @'
[
    {
        "ErrorCode": "0x80D01001",
        "Description": "Delivery Optimization was unable to provide the service."
    },
    {
        "ErrorCode": "0x80D02002",
        "Description": "Download of a file saw no progress within the defined period."
    },
    {
        "ErrorCode": "0x80D02003",
        "Description": "Job was not found."
    },
    {
        "ErrorCode": "0x80D02004",
        "Description": "There were no files in the job."
    },
    {
        "ErrorCode": "0x80D02005",
        "Description": "No downloads currently exist."
    },
    {
        "ErrorCode": "0x80D0200B",
        "Description": "Memory stream transfer is not supported."
    },
    {
        "ErrorCode": "0x80D0200C",
        "Description": "Job has neither completed nor has it been cancelled prior to reaching the max age threshold."
    },
    {
        "ErrorCode": "0x80D0200D",
        "Description": "There is no local file path specified for this download."
    },
    {
        "ErrorCode": "0x80D02010",
        "Description": "No file is available because no URL generated an error."
    },
    {
        "ErrorCode": "0x80D02011",
        "Description": "SetProperty() or GetProperty() called with an unknown property ID."
    },
    {
        "ErrorCode": "0x80D02012",
        "Description": "Unable to call SetProperty() on a read-only property."
    },
    {
        "ErrorCode": "0x80D02013",
        "Description": "The requested action is not allowed in the current job state."
    },
    {
        "ErrorCode": "0x80D02015",
        "Description": "Unable to call GetProperty() on a write-only property."
    },
    {
        "ErrorCode": "0x80D02016",
        "Description": "Download job is marked as requiring integrity checking but integrity checking info was not specified."
    },
    {
        "ErrorCode": "0x80D02017",
        "Description": "Download job is marked as requiring integrity checking but integrity checking info could not be retrieved."
    },
    {
        "ErrorCode": "0x80D02018",
        "Description": "Unable to start a download because no download sink (either local file or stream interface) was specified."
    },
    {
        "ErrorCode": "0x80D02019",
        "Description": "An attempt to set a download sink failed because another type of sink is already set."
    },
    {
        "ErrorCode": "0x80D0201A",
        "Description": "Unable to determine file size from HTTP 200 status code."
    },
    {
        "ErrorCode": "0x80D0201B",
        "Description": "Decryption key was provided but file on CDN does not appear to be encrypted."
    },
    {
        "ErrorCode": "0x80D0201C",
        "Description": "Unable to determine file size from HTTP 206 status code."
    },
    {
        "ErrorCode": "0x80D0201D",
        "Description": "Unable to determine file size from an unexpected HTTP 2xx status code."
    },
    {
        "ErrorCode": "0x80D0201E",
        "Description": "User consent to access the network is required to proceed."
    },
    {
        "ErrorCode": "0x80D02200",
        "Description": "The download was started without providing a URI."
    },
    {
        "ErrorCode": "0x80D02201",
        "Description": "The download was started without providing a content ID."
    },
    {
        "ErrorCode": "0x80D02202",
        "Description": "The specified content ID is invalid."
    },
    {
        "ErrorCode": "0x80D02203",
        "Description": "Ranges are unexpected for the current download."
    },
    {
        "ErrorCode": "0x80D02204",
        "Description": "Ranges are expected for the current download."
    },
    {
        "ErrorCode": "0x80D03001",
        "Description": "Download job not allowed due to participation throttling."
    },
    {
        "ErrorCode": "0x80D03002",
        "Description": "Download job not allowed due to user/admin settings."
    },
    {
        "ErrorCode": "0x80D03801",
        "Description": "DO core paused the job due to cost policy restrictions."
    },
    {
        "ErrorCode": "0x80D03802",
        "Description": "DO job download mode restricted by content policy."
    },
    {
        "ErrorCode": "0x80D03803",
        "Description": "DO core paused the job due to detection of cellular network and policy restrictions."
    },
    {
        "ErrorCode": "0x80D03804",
        "Description": "DO core paused the job due to detection of power state change into non-AC mode.",
        "RelatedPolicyName": "DOMinBatteryPercentageAllowedToUpload",
        "SuggestedRemedy": "Please check your Battery level is enough to P2P."
    },
    {
        "ErrorCode": "0x80D03805",
        "Description": "DO core paused the job due to loss of network connectivity."
    },
    {
        "ErrorCode": "0x80D03806",
        "Description": "DO job download mode restricted by policy."
    },
    {
        "ErrorCode": "0x80D03807",
        "Description": "DO core paused the completed job due to detection of VPN network.",
        "RelatedPolicyName": "DOAllowVPNPeerCaching",
        "SuggestedRemedy": "Check you are connected to any VPN when you are doing P2P."
    },
    {
        "ErrorCode": "0x80D03808",
        "Description": "DO core paused the completed job due to detection of critical memory usage on the system."
    },
    {
        "ErrorCode": "0x80D03809",
        "Description": "DO job download mode restricted due to absence of the cache folder."
    },
    {
        "ErrorCode": "0x80D0380A",
        "Description": "Unable to contact one or more DO cloud services."
    },
    {
        "ErrorCode": "0x80D0380B",
        "Description": "DO job download mode restricted for unregistered caller."
    },
    {
        "ErrorCode": "0x80D0380C",
        "Description": "DO job is using the simple ranges download in simple mode."
    },
    {
        "ErrorCode": "0x80D0380D",
        "Description": "DO job paused due to unexpected HTTP response codes (e.g. 204)."
    },
    {
        "ErrorCode": "0x80D05001",
        "Description": "HTTP server returned a response with data size not equal to what was requested."
    },
    {
        "ErrorCode": "0x80D05002",
        "Description": "The Http server certificate validation has failed."
    },
    {
        "ErrorCode": "0x80D05010",
        "Description": "The specified byte range is invalid."
    },
    {
        "ErrorCode": "0x80D05011",
        "Description": "The server does not support the necessary HTTP protocol. Delivery Optimization (DO) requires that the server support the Range protocol header."
    },
    {
        "ErrorCode": "0x80D05012",
        "Description": "The list of byte ranges contains some overlapping ranges, which are not supported."
    },
    {
        "ErrorCode": "0x80D06800",
        "Description": "Too many bad pieces found during upload."
    },
    {
        "ErrorCode": "0x80D06802",
        "Description": "Fatal error encountered in core."
    },
    {
        "ErrorCode": "0x80D06803",
        "Description": "Services response was an empty JSON content."
    },
    {
        "ErrorCode": "0x80D06804",
        "Description": "Received bad or incomplete data for a content piece."
    },
    {
        "ErrorCode": "0x80D06805",
        "Description": "Content piece hash check failed."
    },
    {
        "ErrorCode": "0x80D06806",
        "Description": "Content piece hash check failed but source is not banned yet."
    },
    {
        "ErrorCode": "0x80D06807",
        "Description": "The piece was rejected because it already exists in the cache."
    },
    {
        "ErrorCode": "0x80D06808",
        "Description": "The piece requested is no longer available in the cache."
    },
    {
        "ErrorCode": "0x80D06809",
        "Description": "Invalid metainfo content."
    },
    {
        "ErrorCode": "0x80D0680A",
        "Description": "Invalid metainfo version."
    },
    {
        "ErrorCode": "0x80D0680B",
        "Description": "The swarm isn't running."
    },
    {
        "ErrorCode": "0x80D0680C",
        "Description": "The peer was not recognized by the connection manager."
    },
    {
        "ErrorCode": "0x80D0680D",
        "Description": "The peer is banned."
    },
    {
        "ErrorCode": "0x80D0680E",
        "Description": "The client is trying to connect to itself."
    },
    {
        "ErrorCode": "0x80D0680F",
        "Description": "The socket or peer is already connected."
    },
    {
        "ErrorCode": "0x80D06810",
        "Description": "The maximum number of connections has been reached."
    },
    {
        "ErrorCode": "0x80D06811",
        "Description": "The connection was lost."
    },
    {
        "ErrorCode": "0x80D06812",
        "Description": "The swarm ID is not recognized."
    },
    {
        "ErrorCode": "0x80D06813",
        "Description": "The handshake length is invalid."
    },
    {
        "ErrorCode": "0x80D06814",
        "Description": "The socket has been closed."
    },
    {
        "ErrorCode": "0x80D06815",
        "Description": "The message is too long."
    },
    {
        "ErrorCode": "0x80D06816",
        "Description": "The message is invalid."
    },
    {
        "ErrorCode": "0x80D06817",
        "Description": "The peer is an upload."
    },
    {
        "ErrorCode": "0x80D06818",
        "Description": "Cannot pin a swarm because it's not in peering mode."
    },
    {
        "ErrorCode": "0x80D06819",
        "Description": "Cannot delete a pinned swarm without using the 'force' flag."
    }
]
'@
 | ConvertFrom-Json

    foreach ($obj in $errorsObj)
    {
        $intValue = [Convert]::ToInt32($obj.ErrorCode, 16)
        $obj.ErrorCode = $intValue
    }

    return $errorsObj
}