Highlighted
Trusted Contributor.
Trusted Contributor.
293 views

Interception of a system error.

Jump to solution

I have a code that contains the function "system.users [i] .name", but the problem is that sometimes "name" may be empty, and a system error occurs that I cannot catch.

Error text:

Script test_3 line 7: ERROR TypeError: system.users[i] has no properties in charater 1

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Interception of a system error.

Jump to solution

I could not reproduce your problem when the name was empty/NULL.

How are you iterating over the users?

Here is my sample

var allUsers = system.users;
for ( u in allUsers )
{
   print( allUsers[u].name );
}

The error " system.users[i] has no properties in character 1" would indicate that the value of 'i' is beyond the end of the array.

 

View solution in original post

6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Interception of a system error.

Jump to solution

I could not reproduce your problem when the name was empty/NULL.

How are you iterating over the users?

Here is my sample

var allUsers = system.users;
for ( u in allUsers )
{
   print( allUsers[u].name );
}

The error " system.users[i] has no properties in character 1" would indicate that the value of 'i' is beyond the end of the array.

 

View solution in original post

Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Interception of a system error.

Jump to solution

the reason for the error in the screenshot

123123123.jpg

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Interception of a system error.

Jump to solution

Yes, I tested my code snippet with the same type of status display ( no name ) and it worked fine.  If the 'name' were the problem the message would say

TypeError: system.users[i].name has no properties in charater 1

The problem is with the entire object system.users[i], that is why I asked to see a code sample.

Other possibility might be different RTE version,  I tested on 9.50 and 9.62 and it worked fine.

 

0 Likes
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Interception of a system error.

Jump to solution

Thanks for the answer.
Have you tested on an industrial system, where there is a frequent connection / disconnection of users?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Interception of a system error.

Jump to solution

No I have not tested on a system with frequent connections and disconnections however it should not matter as the 'user chain' is locked when the JS call is make to build the users list.  Once the list is built the code iterates over a copy of the list.  While the list is locked  a user session cannot be added/removed from the list.

Without a simple test case that illustrates the problem I can only guess as to the cause.

 

Tags (1)
Highlighted
Trusted Contributor.
Trusted Contributor.

Re: Interception of a system error.

Jump to solution

Yes that's right. The code you proposed works without errors. Thanks for the help.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.