ZOHO CRM Vaildate Field with Function

ZOHO CRM Vaildate Field with Function

I want to validate the account status must to be "Inactive" when the opportunity's stage change to "Closed Won" or "Closed Lost", but my code is not working.
The module[opportunity] have field "Account Name", and I take the "Account Name" to get module[Accounts] field "Account Status".

This is my code:
  1. entityMap = crmAPIRequest.toMap().get("record");
  2. Stage = entityMap.get("Stage");
  3. RecAccount = zoho.crm.getRecordById("Accounts",entityMap.get("Account_Name"));
  4. AccountStatus = RecAccount.get("Account_Status");
  5. response = Map();
  6. if(AccountStatus != "Active")
  7. {
  8.       response.put("status",'error');
  9.       response.put('message','Account Status is not Active');
  10. }
How could I debug?
The error message is say "Someting went wrong, Please check your function for any possible failed case"