E10 - Catching errors

Is there a way to catch (and handle) errors in general?

Specifically, on the MOVE INVENTORY screen - if I have a successful transfer, I want to play a sound. If I do not (for example, to/from bin are same) then I would like to play a different sound.

I placed my own button over the TRANSFER button and then do my code underneath. I tried to use a try…catch but not surprisingly, it didn’t work

EpiButton btnT = (EpiButton)csm.GetNativeControlReference("54ab0f30-74d2-4a55-bddc-8845b56b77b1");
try
{		
btnT.PerformClick();
EpiTextBox partb = (EpiTextBox)csm.GetNativeControlReference("8f54f627-4a40-4e54-8a2a-fe39fccf325f");
partb.Focus();
}
catch(Exception e)
{
SoundPlayer simpleSoundb = new SoundPlayer(@"\\myserver\sound\no-thats-not-gonna-do-it.wav");
simpleSoundb.Play();
return;
}

While this is not a big issue, I am just curious for future reference if there is a way to control my code based on these system exceptions.

You lose like a thousand points for being “THAT GUY that makes their program beep, honk and yell… shudder:no_good:

… regardless
If you want to do this you have to invoke the BO’s directly yourself to receive the exception and catch it. Instead of invoking the button clicks.

:blush: Audible feedback for the win. (Devising a plan to write a BPM to quantity adjust my points value)

1 Like

I’m gonna tell the boss that a well respected Epicor Consultant said “Epicor does not support sounds” :smile_cat:

Nah, just tell him Epicor isn’t a 1993 Geocities Website!

6 Likes

OMG - Funniest. Thing. This. Week! You can have the 1000 points I lost for that sweet homepage.

http://images.memes.com/meme/678125

1 Like

omg…laughing…

Ignoring the horrible things that can be done with sound in a UI…Obviously that is test code and you’d simply be writing to a log in the catch as all good code would do :wink:

The type of exceptions returned from the server are all in the Epicor.ServiceModel dll. They will be in the Ice or Ice,Common namespaces. All Biz logic exceptions should be based off Ice.BLException (which is just a derivation of Ice.Common.BusinessObjectException). There are a bunch of other ones such as Ice.Common.RecordNotFoundException - a derivation of Ice.Common.BusinessObjectException.

Beyond that is messing around on the client trying to access the OS then just use normal MS design guidelines.

1 Like