It's a good practice to put code that can throw an exception inside the try... catch block. This is a general good practice and not specific to Appery.io Server Code.
Learn more about JavaScript try-catch.
Example
The following code shows an example of using the try...catch block when updating a user in a database:
try{
var user = DatabaseUser.update(
db_id,
user_id,
{"username":username,"email": email},
userToken
);
} catch(e){
Apperyio.response.error(
{error: e.toString()},
"application/json"
);
}
You can also watch this video to learn how to include try-catch error handling for streamlined debugging.