You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "silver-ymz (via GitHub)" <gi...@apache.org> on 2023/06/18 02:02:12 UTC
[GitHub] [incubator-opendal] silver-ymz commented on a diff in pull request #2475: feat(bindings/haskell): support `is_exist` `create_dir` `copy` `rename` `delete`
silver-ymz commented on code in PR #2475:
URL: https://github.com/apache/incubator-opendal/pull/2475#discussion_r1233174217
##########
bindings/haskell/haskell-src/OpenDAL.hs:
##########
@@ -28,16 +33,48 @@ import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
import Foreign
import Foreign.C.String
+import Foreign.C.Types (CChar)
import OpenDAL.FFI
-newtype Operator = Operator (Ptr RawOperator)
+newtype Operator = Operator (ForeignPtr RawOperator)
+
+data ErrorCode
+ = FFIError
+ | Unexpected
+ | Unsupported
+ | ConfigInvalid
+ | NotFound
+ | PermissionDenied
+ | IsADirectory
+ | NotADirectory
+ | AlreadyExists
+ | RateLimited
+ | IsSameFile
+ deriving (Eq, Show)
+
+data OpenDALError = OpenDALError {errorCode :: ErrorCode, message :: String}
Review Comment:
We can rename it to `Error`. However, the standard library has a general type class (similar to `trait` in Rust) called `Error`. This is prone to naming clashes.
I prefer to use `OpenDALError` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org