在 Interactor 中使用 file.read 逻辑读取文件
Reading file using file.read logic in Interactor
[interactor] workspace-test > 运行 file.read /Users/mycomputer/Desktop/test.txt
:enoent
[交互器] 工作区测试 >
以上是我在运行file.read逻辑时得到的。
Q1。错误消息 :enoent 是什么意思?
Q2。如何查看Interactor是否读取文件?
:enoent 代表 "error no entity" 表示该文件不存在。您可能需要仔细检查文件路径是否正确。
您还可以使用 file.exist 函数在您的逻辑中处理 non-existing 文件。例如:
service read : map
# 1: file_path
on start : if (file.exist ) (file.read ) (event error)
on error : list
error = 'File does not exist: '
log 'service.read.error' $error
throw $error
exit
exit
[interactor] workspace-test > 运行 file.read /Users/mycomputer/Desktop/test.txt
:enoent
[交互器] 工作区测试 >
以上是我在运行file.read逻辑时得到的。 Q1。错误消息 :enoent 是什么意思? Q2。如何查看Interactor是否读取文件?
:enoent 代表 "error no entity" 表示该文件不存在。您可能需要仔细检查文件路径是否正确。
您还可以使用 file.exist 函数在您的逻辑中处理 non-existing 文件。例如:
service read : map
# 1: file_path
on start : if (file.exist ) (file.read ) (event error)
on error : list
error = 'File does not exist: '
log 'service.read.error' $error
throw $error
exit
exit