if your using event handlers, select it and view all properties in designer, there are 3 events "onComplete", "onError", "onStart" that can be used.
if you mean raw SSJS somewhere on a page, its the same as standard JS
try
{
// code that will throw error
}
catch(err)
{
// some code to handle, e.g. redirect to page that has error message, try something else etc.
}