Developer Function: Server Script: TryCatch
## Overview
This function automatically converts code written in "[Server Script](/en/manual/table-management-server-script)" into a try-catch statement and executes it. By checking "TryCatch", the written code is set in a try block, and in the catch block, a process is set to output the error content in "[logs.LogException](/en/manual/server-script-logs-log-exception)". This displays the error content in the console on the browser's administrator tool and records it in the system log.
## Limitations
1. If "TryCatch" and "[Function](/en/manual/server-script-functionalize)" are checked at the same time, the code will be made into an anonymous function and then converted into a try-catch statement.
## Conversion image
### Written server script
##### JavaScript
```
// siteId: 9999 is a site ID that does not exist
const siteId = 9999;
const sites = items.Get(siteId);
context.Log(sites[0]); // An error occurs when specifying an array index
```
### Server script that is converted and executed by checking "TryCatch" ON
##### JavaScript
```
try {
// siteId: 9999 is a site ID that does not exist
const siteId = 9999;
const sites = items.Get(siteId);
context.Log(sites[0]); // An error occurs when specifying an array index
} catch(e) {
log.LogException(※Server script information※\n + e.stack)
}
```
※Server script information※ is a string that combines the following information.
Fixed string "(Exception):", server script ID, title, name
## Example
### Set body

### Execution result

## Supported Versions
|Supported versions|Body|
|:--|:--|
|1.4.12.0 and later|Add function|
## Related Information
<div id="ManualList"><ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/server-script-functionalize">Developer Function: Server Script: Function</a><span>06.26.2025 up</span></li>
<li><a href="/en/manual/server-script-logs-log-exception">Developer Function: Server Script: logs.LogException</a><span>06.26.2025 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />