{"action":"closed","issue":{"url":"https://api.github.com/repos/Cyan4973/zstd/issues/168","repository_url":"https://api.github.com/repos/Cyan4973/zstd","labels_url":"https://api.github.com/repos/Cyan4973/zstd/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/Cyan4973/zstd/issues/168/comments","events_url":"https://api.github.com/repos/Cyan4973/zstd/issues/168/events","html_url":"https://github.com/Cyan4973/zstd/issues/168","id":148135847,"number":168,"title":"Ambiguous error handling","user":{"login":"cher-nov","id":11665634,"avatar_url":"https://avatars.githubusercontent.com/u/11665634?v=3","gravatar_id":"","url":"https://api.github.com/users/cher-nov","html_url":"https://github.com/cher-nov","followers_url":"https://api.github.com/users/cher-nov/followers","following_url":"https://api.github.com/users/cher-nov/following{/other_user}","gists_url":"https://api.github.com/users/cher-nov/gists{/gist_id}","starred_url":"https://api.github.com/users/cher-nov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cher-nov/subscriptions","organizations_url":"https://api.github.com/users/cher-nov/orgs","repos_url":"https://api.github.com/users/cher-nov/repos","events_url":"https://api.github.com/users/cher-nov/events{/privacy}","received_events_url":"https://api.github.com/users/cher-nov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-04-13T17:56:46Z","updated_at":"2016-05-13T13:04:29Z","closed_at":"2016-05-13T13:04:29Z","body":"I'm writing a wrapper for **ZStd** and faced with a problem.\r\nAFAIK, currently in **ZStd** there's two ways to remember error code before it will be retrieved by user through some wrapper function:\r\n\r\n1. Remember error code as last **_size_t_** for which **_ZSTD_isError()_** (**_ZBUFF_isError()_** in my case, but who cares?) has returned **_TRUE_**.\r\n2. Convert errorneous **_size_t_** values to the **_ZSTD_ErrorCode_** enum value and store it.\r\n\r\nThe problem is this:\r\n\r\n1. In first case, I can't preliminarily initialize error variable by some **_NO_ERROR_** value because **_size_t_** error codes are undocumented, could change in the future etc. Also I can't reset internal error state to **_NO_ERROR_** after the user has received an error code.\r\n2. In second case, I can't write an interface function to get error description string properly because there's no version of **_ZSTD_getErrorName()_** for **_ZSTD_ErrorCode_** values.\r\n\r\nI know that the possible solution is to store both **_size_t_** and **_ZSTD_ErrorCode_** values, but I'm sure that things could be done better from **ZStd** side.\r\n\r\nForgive me in advance for amazingly awful English."}}