javascript - Powershell 捕获 curl 错误
问题描述
我有一个简单的 Powershell 函数来调用 Web api 并获得响应。如何确定 Web api 调用是成功还是失败。如果失败,我如何只记录失败的异常消息。我正在为 Windows 使用 curl。下面是我的 Powershell 脚本,
function PowershellCore_CurlFunction()
{
$curlResponse = curl -s "$url"
# How to check if web api call is succeeded or failed
# How to log error if web api call throws exception
}
解决方案
推荐阅读
- cakephp - CakePHP 3 启用 twig dump()
- javascript - 在选择中更改选项时更改图像
- javascript - Vue stopPropagation 不起作用 - 孩子到父母
- php - 是否可以使用 FANN 制作 RNN
- javascript - 我设置 axios 调用的方式有什么问题?
- shell - 用于在模式中查找字符串的 Shell 脚本
- c# - 读取具有唯一标识符 ID 的表
- shell - jq json解析数组元素
- python-3.6 - Impala 查询不以异步方式执行
- android - E/AndroidRuntime:致命异常:主 PID:4435