douguan8940 2016-06-29 15:42
浏览 38

Active Collab API异常处理

I am running Active Collab 5.8.7 with PHP 5.6. I am using the API to create a Company and User. The API works but if there are any errors, the errors do not bubble up to the calling PHP script. I am using the approach outlined here.

try {
    $client->post('projects/65/tasks', [
      'name' => 'This is a task name',
      'assignee_id' => 48
    ]);
} catch(AppException $e) {
    print $e->getMessage() . '<br><br>';
    // var_dump($e->getServerResponse()); (need more info?)
}

The only way I can catch errors is by turning on debugging in Active Collab config.php and watching the log file. For instance, in the above example, the task_list_id is missing but it is required. I didn't figure that out until I looked in the log. I would expect that error to bubble up so I can catch it in my script.

Does anyone know how to make these errors bubble up?

  • 写回答

1条回答 默认 最新

  • douyaosi3164 2016-06-30 12:58
    关注

    Active Collab is pretty "secretive" about debugging info when running in production mode. To have the exact error logged, use debugging mode.

    To turn on debug mode, open Active Collab's config/config.php and add:

    const APPLICATION_MODE = 'debug';
    

    in the block where other settings are defined. Note that you might already have APPLICATION_MODE constant defined in config/config.php in some cases, so look for it first.

    评论

报告相同问题?

悬赏问题

  • ¥15 vscode问题请教
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM