LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Style Challenge - Error Wires

This is really simple:

 

The only reason to ignore the error output of a function is if you will never, ever care whether that function actually worked.

Message 91 of 147
(866 Views)

@Taggart wrote:

@SteenSchmidt wrote:

 

Why do you think 'Close Reference' can output at least 4 different error codes for refnum invalidity?

hmm... didn't realize it gave off 4 different error codes. Will have to look into that. As I mentioned before my understanding was the only time that fails is when the refnum is invalid (ie it was never valid to begin with or something else closed it.)


In all fairness all 4 are different kinds of 'invalid'. I do not know if it can emit other error codes now or in the future. And I would still not be happy if something else closed a reference I was supposed to close.

 

One example of a close where it would be wise of you to look at why close didn't work is 'TCP Close Connection': Your future regarding that socket and perhaps ethernet communication in general from your application will depend on what you do after a failed close. 'TCP Close Connection' can output ca 15 different error codes, and you need to do something intelligent in several of the cases. So to reiterate: My objection is mainly with templating your way around stuff, like always silently closing a reference. Be very careful with that.

CLA, CTA, CLED & LabVIEW Champion
0 Kudos
Message 92 of 147
(860 Views)

My answer too.

Untitled.png

Juan Navarro
0 Kudos
Message 93 of 147
(848 Views)

@SteenSchmidt wrote:
So to reiterate: My objection is mainly with templating your way around stuff, like always silently closing a reference. Be very careful with that.

Who was talking templating around anything? I simply said I often don't catch certain errors because there some situations where I just don't care if closing the reference throws an error. Perhaps that is naive but its worked for me so far. It hasn't bitten me yet. Maybe some day it will and I'll change my tune.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
Message 94 of 147
(824 Views)

@SteenSchmidt wrote:

... 'TCP Close Connection' can output ca 15 different error codes, ...

I've been wondering about that - is there a way to look up the possible errors a given function might emit? That would be quite the help in figuring out how to handle them.

0 Kudos
Message 95 of 147
(802 Views)

@LLindenbauer wrote:

@SteenSchmidt wrote:

... 'TCP Close Connection' can output ca 15 different error codes, ...

I've been wondering about that - is there a way to look up the possible errors a given function might emit? That would be quite the help in figuring out how to handle them.


You can dig through the error codes and see what would make sense for a function.  Otherwise, see this idea: List every error code a function can give out! 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 96 of 147
(795 Views)

@crossrulz  a écrit :

@LLindenbauer wrote:

@SteenSchmidt wrote:

... 'TCP Close Connection' can output ca 15 different error codes, ...

I've been wondering about that - is there a way to look up the possible errors a given function might emit? That would be quite the help in figuring out how to handle them.


You can dig through the error codes and see what would make sense for a function.  Otherwise, see this idea: List every error code a function can give out! 


Thanks for the link.

I took a look at it, in the comments it's explained that it's impossible to document the error codes outing of a function.

0 Kudos
Message 97 of 147
(789 Views)

@Taggart wrote:

@SteenSchmidt wrote:
So to reiterate: My objection is mainly with templating your way around stuff, like always silently closing a reference. Be very careful with that.

Who was talking templating around anything? I simply said I often don't catch certain errors because there some situations where I just don't care if closing the reference throws an error. Perhaps that is naive but its worked for me so far. It hasn't bitten me yet. Maybe some day it will and I'll change my tune.


It didn't start with you, it began with SebastienM much earlier 🙂

 

In message 40 SebastienM said: "As a TestStand user, I always make silent cleanups"

 

In message 52 I replied to SebastienM: "Repeating the same thing mindlessly is bound to get you into trouble"

 

In message 72 you replied to me: "As to close outputting an error, ok great, but what do I do with that?"

 

From there we were dicussing different Close functions, and I also held the opinion that even a failed Close due to invalid refnum is important, because it is unexpected (what other side effects came from that unexpected situation?). The latter you don't agree with, fair enough. But it was initially SebastienM's notion that "I always make silent cleanups" that got me worried. I completely agree with considering each scenario individually and then silence some things you have considered. But to do it as a "template" is dangerous. The "templating" comment was targeted at SebastienM's practice.

CLA, CTA, CLED & LabVIEW Champion
0 Kudos
Message 98 of 147
(766 Views)

@SteenSchmidt wrote:

@Taggart wrote:

@SteenSchmidt wrote:
So to reiterate: My objection is mainly with templating your way around stuff, like always silently closing a reference. Be very careful with that.

Who was talking templating around anything? I simply said I often don't catch certain errors because there some situations where I just don't care if closing the reference throws an error. Perhaps that is naive but its worked for me so far. It hasn't bitten me yet. Maybe some day it will and I'll change my tune.


It didn't start with you, it began with SebastienM much earlier 🙂

 

In message 40 SebastienM said: "As a TestStand user, I always make silent cleanups"

 

In message 52 I replied to SebastienM: "Repeating the same thing mindlessly is bound to get you into trouble"

 

In message 72 you replied to me: "As to close outputting an error, ok great, but what do I do with that?"

 

From there we were dicussing different Close functions, and I also held the opinion that even a failed Close due to invalid refnum is important, because it is unexpected (what other side effects came from that unexpected situation?). The latter you don't agree with, fair enough. But it was initially SebastienM's notion that "I always make silent cleanups" that got me worried. I completely agree with considering each scenario individually and then silence some things you have considered. But to do it as a "template" is dangerous. The "templating" comment was targeted at SebastienM's practice.


I see your point.

I've heard you talk about your error handling strategy before and how you consider errors as part of the API and do all the translation at each layer. I haven't gone to all those lengths, but I do agree with it.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 99 of 147
(752 Views)

On a side note, I am impressed that a simple question turned into a 100 post thread (one more to go!).

 

(... and it's not even about religion or politics! I stayed mostly out of it because my programs don't generate errors 😄 JK)

Message 100 of 147
(735 Views)