How can I do this ? Like i have the main script and a error check script to see if an error is thrown in the main script.
You can use the Error event
The error event? You're nuts.
Apparently there's an event for when stuff errors: ScriptContext.Error