-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathdebugging.html
60 lines (50 loc) · 1.92 KB
/
debugging.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
layout: default
navPage: docs
heading: Debugging Mode
breadcrumbs:
- API,/api/
- API v2.x,/api/v2
- Debugging Mode
prev: Finalized Submissions,/api/v2/finalized/
next: Class Methods,/api/v2/class_methods/
versions: FT3
categories: api
tags: developer
---
{% include open_section.html nav='nav_api_v2.html' selected='debugging' nav_width=4 %}
<p>
The API uses the <code>$g_api_debug</code> variable used to toggle debugging mode on and off for
all the API functions. By default, debugging is <b>disabled</b>. On API versions earlier than 2.0.0, this
setting was enabled by default.
</p>
<p>
When you're in debugging mode, any time an error occurs it halts your code and displays the error in the
webpage. The errors consistent of the error type ("user" or "system") and the unique error code. The page
contains a link to the online help documentation which describes the nature of the error - and maybe a tip
or two to solve it. Error types indicate the severity of the error. "user" errors indicate that the function
has been fed an incorrect value or two; "system" errors mean that some worse has happened: either a file is
missing or there's a bug on our end.
</p>
<p>
You can turn on/off debugging in two ways. First, by adding the <code>$g_api_debug</code> variable to your page
before you instantiate the API class to use its methods:
</p>
{% codemirror php %}
<?php
require_once("/path/to/global/api/API.class.php");
$g_api_debug = true;
$api = new FormTools\API();
?>
{% endcodemirror %}
<p>
Or, you can just add the following line to your /global/config.php file:
</p>
{% codemirror php %}
$g_api_debug = true;
{% endcodemirror %}
<p>
This will set the debug value for any methods calling the API <i>unless</i> that location has specified their
own value, which will override this default.
</p>
{% include close_section.html %}