Manual error tracking installation

Last updated:

|Edit this page|

Error tracking enables you to track, investigate, and resolve exceptions your customers face.

If you're using the API or an SDK without exception autocapture or capture_exception method, you can manually capture errors by using the capture API or capture method to capture an $exception event with the following properties:

PropertyDescription
$exception_listA list of exception objects with detailed information about each error. Each exception can include a type, value, mechanism, module, thread_id, and a stacktrace with frames and type. You can find the expected schema as types for both exception and stack frames in our JS repo
$exception_fingerprint(Optional) The identifier used to group issues. If not set, a unique hash based on the exception pattern will be generated during ingestion

The expected schema is described as a type in our JS repo.

Example exception API capture

Terminal
curl -X POST "https://us.i.posthog.com/i/v0/e/" \
-H "Content-Type: application/json" \
-d '{
"api_key": "<ph_project_api_key>",
"event": "$exception",
"properties": {
"distinct_id": "distinct_id_of_your_user",
"$exception_list": [{
"type": "RangeError",
"value": "Maximum call stack size exceeded",
"mechanism": {
"handled": true,
"synthetic": false
},
"stacktrace": {
"type": "resolved",
"frames": [
{
"raw_id": "89f3907385ddb1bdc2feebd77625387d685e3da2f9a68bcf2634e3b3b39122e51f895e5c880def374525c558899b2e90eed214900ff9c8f949243e4b79eb32a9",
"mangled_name": "Array.forEach",
"in_app": false,
"resolved_name": "Array.forEach",
"lang": "javascript",
"resolved": true
},
/* Additional frames omitted for brevity */
]
}
}],
"$exception_fingerprint": "209842d96784e19321e3a36b068d53fff7a01ebcb1da9e98df35c4c49db0b4f3b62aea7ee25a714470e61f8d36b4716f227f241c153477e5fa9adfda64ce9f71"
},
}'

Questions? Ask Max AI.

It's easier than reading through 718 pages of documentation

Community questions

Was this page useful?

Next article

Upload source maps

If you serve compiled or minified code, PostHog requires source maps to generate accurate stack traces. If your source maps are not publicly hosted, you will need to upload them during your build process to see unminified code in your stack traces. Choose your platform to view specific instructions.

Read next article