Skip to content

Better SOAP error handling#141

Merged
RogerHardiman merged 1 commit into
agsh:masterfrom
bl0ggy:better_soap_error_handling
Feb 20, 2020
Merged

Better SOAP error handling#141
RogerHardiman merged 1 commit into
agsh:masterfrom
bl0ggy:better_soap_error_handling

Conversation

@bl0ggy

@bl0ggy bl0ggy commented Feb 20, 2020

Copy link
Copy Markdown
Contributor

On SOAP error, some cameras send a wrong SOAP structure (see Issue #73).
This PR permit to avoid having the error "TypeError: Cannot read property '0' of undefined", but instead will try to read both reason and detail information, if one of them is wrong, we can still get the other.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.4%) to 86.873% when pulling e57d9b2 on bl0ggy:better_soap_error_handling into 2a7f9fe on agsh:master.

@RogerHardiman

Copy link
Copy Markdown
Collaborator

Hi
The try/catch is fine.
In another part of the project (in some of the Pull event handler code) I import the lodash-get library (a small part of lodash).
This has a _get fuction which does not throw if you get an item that is null (or the parent is null)

You can see me using it here...
ccdaff3

So I'll do the commit because try/catch is fine. But _get may give cleaner looking code in the future.

Thanks
Roger

@RogerHardiman RogerHardiman reopened this Feb 20, 2020
@RogerHardiman RogerHardiman merged commit 1a99557 into agsh:master Feb 20, 2020
@bl0ggy

bl0ggy commented Feb 20, 2020

Copy link
Copy Markdown
Contributor Author

I did not know about that library, thank you for the information.

@bl0ggy bl0ggy deleted the better_soap_error_handling branch February 20, 2020 12:27
@RogerHardiman

Copy link
Copy Markdown
Collaborator

There are a few NodeJS libraries that are very popular and used in lots of software.
One is called Underscore and the other is called Lodash.

They are libraries packed will handy functions to make writing javascript easier.

Roger

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.

3 participants