Skip to content

Fix error handling in session list parsing#14

Open
rra wants to merge 1 commit intomasterfrom
session-list-errors
Open

Fix error handling in session list parsing#14
rra wants to merge 1 commit intomasterfrom
session-list-errors

Conversation

@rra
Copy link
Collaborator

@rra rra commented May 13, 2018

If GetOptionsFromString returned an error, parse_session_list
returned an explicit undef, which isn't treated as an empty hash
and resulted in errors like this:

Apr 29 19:06:23 haven uberbot[317]: Odd number of elements in hash assignment at /usr/share/perl5/Calvin/Bots/Cambot.pm line 536.
Apr 29 19:06:23 haven uberbot[317]: Use of uninitialized value in list assignment at /usr/share/perl5/Calvin/Bots/Cambot.pm line 536.

The error from GetOptionsFromString was also reported to standard
error. Suppress that with a WARN handler and use a bare return
to return an empty list.

If GetOptionsFromString returned an error, parse_session_list
returned an explicit undef, which isn't treated as an empty hash
and resulted in errors like this:

```
Apr 29 19:06:23 haven uberbot[317]: Odd number of elements in hash assignment at /usr/share/perl5/Calvin/Bots/Cambot.pm line 536.
Apr 29 19:06:23 haven uberbot[317]: Use of uninitialized value in list assignment at /usr/share/perl5/Calvin/Bots/Cambot.pm line 536.
```

The error from GetOptionsFromString was also reported to standard
error.  Suppress that with a __WARN__ handler and use a bare return
to return an empty list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant