Skip to main content

Posts

Showing posts with the label try catch and throw

Exception handling in Microsoft dynamics Axapta

Example of Exception handling in microsoft dynamics axapta x++ try { // Do something info("Now I'm here"); // A situation that causes an error occurs and you would // like to stop the execution flow if (true) throw error("Oops! Something happened"); info("Now I'm there"); } catch (Exception::Error) { // Handle the error exception info ("I would like to inform you that an error occurred "); } catch (Exception::Deadlock) { // Handle the deadlock exception // Wait for 10 seconds and try again sleep(10000); retry; } info ("This is the end"); }